From antoniomurdaca at gmail.com Mon Jun 1 07:26:07 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 1 Jun 2015 09:26:07 +0200 Subject: [lustre-devel] [PATCH] staging: lustre: cleanup not needed else clauses Message-ID: <1433143567-13599-1-git-send-email-antonio.murdaca@gmail.com> cleanup checkpatch.pl warnings about not needed else clauses after a break or return Signed-off-by: Antonio Murdaca --- drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++- .../staging/lustre/lustre/include/lprocfs_status.h | 3 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 36 +++++++++++----------- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++--- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +- drivers/staging/lustre/lustre/lov/lov_request.c | 3 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++-- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- drivers/staging/lustre/lustre/osc/osc_request.c | 14 +++++---- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 ++--- 13 files changed, 50 insertions(+), 59 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 7aee393..d124727 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -201,10 +201,9 @@ static int seq_client_alloc_seq(const struct lu_env *env, CERROR("%s: Can't allocate new meta-sequence, rc %d\n", seq->lcs_name, rc); return rc; - } else { - CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", - seq->lcs_name, PRANGE(&seq->lcs_space)); } + CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", + seq->lcs_name, PRANGE(&seq->lcs_space)); } else { rc = 0; } diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index d030847..e423ade 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -422,9 +422,8 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, else spin_lock(&stats->ls_lock); return 1; - } else { - return stats->ls_biggest_alloc_num; } + return stats->ls_biggest_alloc_num; } } diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 19448fe..47aa8c4 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -836,25 +836,25 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, *exceed = 1; } return result; - } else { - /* - * region is within kms and, hence, within real file - * size (A). We need to increase i_size to cover the - * read region so that generic_file_read() will do its - * job, but that doesn't mean the kms size is - * _correct_, it is only the _minimum_ size. If - * someone does a stat they will get the correct size - * which will always be >= the kms value here. - * b=11081 - */ - if (cl_isize_read(inode) < kms) { - cl_isize_write_nolock(inode, kms); - CDEBUG(D_VFSTRACE, - DFID" updating i_size %llu\n", - PFID(lu_object_fid(&obj->co_lu)), - (__u64)cl_isize_read(inode)); + } + + /* + * region is within kms and, hence, within real file + * size (A). We need to increase i_size to cover the + * read region so that generic_file_read() will do its + * job, but that doesn't mean the kms size is + * _correct_, it is only the _minimum_ size. If + * someone does a stat they will get the correct size + * which will always be >= the kms value here. + * b=11081 + */ + if (cl_isize_read(inode) < kms) { + cl_isize_write_nolock(inode, kms); + CDEBUG(D_VFSTRACE, + DFID" updating i_size %llu\n", + PFID(lu_object_fid(&obj->co_lu)), + (__u64)cl_isize_read(inode)); - } } } ccc_object_size_unlock(obj); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 0a0b435..764f986 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -667,10 +667,9 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) DEBUG_REQ(D_NET, req, "processing error (%d)", rc); req->rq_status = rc; return ptlrpc_send_error(req, 1); - } else { - DEBUG_REQ(D_NET, req, "sending reply"); } + DEBUG_REQ(D_NET, req, "sending reply"); return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT); } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 6a22f41..bb2246d 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -931,7 +931,9 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else if (lock->l_resource->lr_type == LDLM_IBITS) { + } + + if (lock->l_resource->lr_type == LDLM_IBITS) { for (;;) { policy_end = list_entry(lock->l_sl_policy.prev, @@ -967,11 +969,10 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else { - LDLM_ERROR(lock, - "is not LDLM_PLAIN or LDLM_IBITS lock"); - LBUG(); } + + LDLM_ERROR(lock, "is not LDLM_PLAIN or LDLM_IBITS lock"); + LBUG(); } /* insert point is last lock on the queue, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 53e1377..ee3971e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1362,8 +1362,7 @@ static int ldlm_pools_thread_main(void *arg) if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - else - thread_test_and_clear_flags(thread, SVC_EVENT); + thread_test_and_clear_flags(thread, SVC_EVENT); } thread_set_flags(thread, SVC_STOPPED); diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index f6e1314..8fdfd68 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -617,8 +617,7 @@ void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs, if (tmp & 1) { if (quit) break; - else - quit = 1; + quit = 1; shift = 0; } tmp >>= 1; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index cbbdfce..539c31d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -75,11 +75,11 @@ static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, if (IS_ERR(c)) { CDEBUG(D_INFO, "alloc capa failed!\n"); return PTR_ERR(c); - } else { - c->c_capa = *capa; - *oc = c; - return 0; } + + c->c_capa = *capa; + *oc = c; + return 0; } static inline int mdc_queue_wait(struct ptlrpc_request *req) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index f13d1fb..163fe0c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -906,10 +906,8 @@ struct lu_env *cl_env_nested_get(struct cl_env_nest *nest) if (env != NULL) { if (!cl_io_is_going(env)) return env; - else { - cl_env_put(env, &nest->cen_refcheck); - nest->cen_cookie = cl_env_reenter(); - } + cl_env_put(env, &nest->cen_refcheck); + nest->cen_cookie = cl_env_reenter(); } env = cl_env_get(&nest->cen_refcheck); if (IS_ERR(env)) { diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c8f6ab0..48dbbcf 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -279,9 +279,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_read(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } up_read(&cathandle->lgh_lock); @@ -299,9 +298,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_write(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } CDEBUG(D_INODE, "use next log\n"); diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 350ad49..2516e2f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1176,8 +1176,7 @@ static int osc_lock_wait(const struct lu_env *env, /* It is from enqueue RPC reply upcall for * updating state. Do not re-enqueue. */ return -ENAVAIL; - else - olck->ols_state = OLS_NEW; + olck->ols_state = OLS_NEW; } else { LASSERT(lock->cll_error); return lock->cll_error; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index ded184e..065d8ff 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1007,8 +1007,8 @@ static int osc_should_shrink_grant(struct client_obd *client) if (client->cl_import->imp_state == LUSTRE_IMP_FULL && client->cl_avail_grant > brw_size) return 1; - else - osc_update_next_shrink(client); + + osc_update_next_shrink(client); } return 0; } @@ -2300,7 +2300,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, mode); LDLM_LOCK_PUT(matched); return -ECANCELED; - } else if (osc_set_lock_data_with_check(matched, einfo)) { + } + + if (osc_set_lock_data_with_check(matched, einfo)) { *flags |= LDLM_FL_LVB_READY; /* addref the lock only if not async requests and PW * lock is matched whereas we asked for PR. */ @@ -2325,10 +2327,10 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, einfo->ei_mode); LDLM_LOCK_PUT(matched); return ELDLM_OK; - } else { - ldlm_lock_decref(lockh, mode); - LDLM_LOCK_PUT(matched); } + + ldlm_lock_decref(lockh, mode); + LDLM_LOCK_PUT(matched); } no_match: diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 5abb91c..7106049 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -289,12 +289,10 @@ static int ptlrpc_pinger_main(void *arg) thread_is_stopping(thread) || thread_is_event(thread), &lwi); - if (thread_test_and_clear_flags(thread, SVC_STOPPING)) { + if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - } else { - /* woken after adding import to reset timer */ - thread_test_and_clear_flags(thread, SVC_EVENT); - } + /* woken after adding import to reset timer */ + thread_test_and_clear_flags(thread, SVC_EVENT); } } -- 2.4.2 From antoniomurdaca at gmail.com Mon Jun 1 07:29:10 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 1 Jun 2015 09:29:10 +0200 Subject: [lustre-devel] [PATCH] staging: lustre: cleanup not needed else clauses Message-ID: <1433143750-13904-1-git-send-email-antonio.murdaca@gmail.com> cleanup checkpatch.pl warnings about not needed else clauses after a break or return Signed-off-by: Antonio Murdaca --- drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++- .../staging/lustre/lustre/include/lprocfs_status.h | 3 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 36 +++++++++++----------- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++--- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +- drivers/staging/lustre/lustre/lov/lov_request.c | 3 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++-- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- drivers/staging/lustre/lustre/osc/osc_request.c | 14 +++++---- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 ++--- 13 files changed, 50 insertions(+), 59 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 7aee393..d124727 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -201,10 +201,9 @@ static int seq_client_alloc_seq(const struct lu_env *env, CERROR("%s: Can't allocate new meta-sequence, rc %d\n", seq->lcs_name, rc); return rc; - } else { - CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", - seq->lcs_name, PRANGE(&seq->lcs_space)); } + CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", + seq->lcs_name, PRANGE(&seq->lcs_space)); } else { rc = 0; } diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index d030847..e423ade 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -422,9 +422,8 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, else spin_lock(&stats->ls_lock); return 1; - } else { - return stats->ls_biggest_alloc_num; } + return stats->ls_biggest_alloc_num; } } diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 19448fe..47aa8c4 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -836,25 +836,25 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, *exceed = 1; } return result; - } else { - /* - * region is within kms and, hence, within real file - * size (A). We need to increase i_size to cover the - * read region so that generic_file_read() will do its - * job, but that doesn't mean the kms size is - * _correct_, it is only the _minimum_ size. If - * someone does a stat they will get the correct size - * which will always be >= the kms value here. - * b=11081 - */ - if (cl_isize_read(inode) < kms) { - cl_isize_write_nolock(inode, kms); - CDEBUG(D_VFSTRACE, - DFID" updating i_size %llu\n", - PFID(lu_object_fid(&obj->co_lu)), - (__u64)cl_isize_read(inode)); + } + + /* + * region is within kms and, hence, within real file + * size (A). We need to increase i_size to cover the + * read region so that generic_file_read() will do its + * job, but that doesn't mean the kms size is + * _correct_, it is only the _minimum_ size. If + * someone does a stat they will get the correct size + * which will always be >= the kms value here. + * b=11081 + */ + if (cl_isize_read(inode) < kms) { + cl_isize_write_nolock(inode, kms); + CDEBUG(D_VFSTRACE, + DFID" updating i_size %llu\n", + PFID(lu_object_fid(&obj->co_lu)), + (__u64)cl_isize_read(inode)); - } } } ccc_object_size_unlock(obj); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 0a0b435..764f986 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -667,10 +667,9 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) DEBUG_REQ(D_NET, req, "processing error (%d)", rc); req->rq_status = rc; return ptlrpc_send_error(req, 1); - } else { - DEBUG_REQ(D_NET, req, "sending reply"); } + DEBUG_REQ(D_NET, req, "sending reply"); return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT); } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 6a22f41..bb2246d 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -931,7 +931,9 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else if (lock->l_resource->lr_type == LDLM_IBITS) { + } + + if (lock->l_resource->lr_type == LDLM_IBITS) { for (;;) { policy_end = list_entry(lock->l_sl_policy.prev, @@ -967,11 +969,10 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else { - LDLM_ERROR(lock, - "is not LDLM_PLAIN or LDLM_IBITS lock"); - LBUG(); } + + LDLM_ERROR(lock, "is not LDLM_PLAIN or LDLM_IBITS lock"); + LBUG(); } /* insert point is last lock on the queue, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 53e1377..ee3971e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1362,8 +1362,7 @@ static int ldlm_pools_thread_main(void *arg) if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - else - thread_test_and_clear_flags(thread, SVC_EVENT); + thread_test_and_clear_flags(thread, SVC_EVENT); } thread_set_flags(thread, SVC_STOPPED); diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index f6e1314..8fdfd68 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -617,8 +617,7 @@ void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs, if (tmp & 1) { if (quit) break; - else - quit = 1; + quit = 1; shift = 0; } tmp >>= 1; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index cbbdfce..539c31d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -75,11 +75,11 @@ static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, if (IS_ERR(c)) { CDEBUG(D_INFO, "alloc capa failed!\n"); return PTR_ERR(c); - } else { - c->c_capa = *capa; - *oc = c; - return 0; } + + c->c_capa = *capa; + *oc = c; + return 0; } static inline int mdc_queue_wait(struct ptlrpc_request *req) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index f13d1fb..163fe0c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -906,10 +906,8 @@ struct lu_env *cl_env_nested_get(struct cl_env_nest *nest) if (env != NULL) { if (!cl_io_is_going(env)) return env; - else { - cl_env_put(env, &nest->cen_refcheck); - nest->cen_cookie = cl_env_reenter(); - } + cl_env_put(env, &nest->cen_refcheck); + nest->cen_cookie = cl_env_reenter(); } env = cl_env_get(&nest->cen_refcheck); if (IS_ERR(env)) { diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c8f6ab0..48dbbcf 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -279,9 +279,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_read(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } up_read(&cathandle->lgh_lock); @@ -299,9 +298,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_write(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } CDEBUG(D_INODE, "use next log\n"); diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 350ad49..2516e2f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1176,8 +1176,7 @@ static int osc_lock_wait(const struct lu_env *env, /* It is from enqueue RPC reply upcall for * updating state. Do not re-enqueue. */ return -ENAVAIL; - else - olck->ols_state = OLS_NEW; + olck->ols_state = OLS_NEW; } else { LASSERT(lock->cll_error); return lock->cll_error; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index ded184e..065d8ff 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1007,8 +1007,8 @@ static int osc_should_shrink_grant(struct client_obd *client) if (client->cl_import->imp_state == LUSTRE_IMP_FULL && client->cl_avail_grant > brw_size) return 1; - else - osc_update_next_shrink(client); + + osc_update_next_shrink(client); } return 0; } @@ -2300,7 +2300,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, mode); LDLM_LOCK_PUT(matched); return -ECANCELED; - } else if (osc_set_lock_data_with_check(matched, einfo)) { + } + + if (osc_set_lock_data_with_check(matched, einfo)) { *flags |= LDLM_FL_LVB_READY; /* addref the lock only if not async requests and PW * lock is matched whereas we asked for PR. */ @@ -2325,10 +2327,10 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, einfo->ei_mode); LDLM_LOCK_PUT(matched); return ELDLM_OK; - } else { - ldlm_lock_decref(lockh, mode); - LDLM_LOCK_PUT(matched); } + + ldlm_lock_decref(lockh, mode); + LDLM_LOCK_PUT(matched); } no_match: diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 5abb91c..7106049 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -289,12 +289,10 @@ static int ptlrpc_pinger_main(void *arg) thread_is_stopping(thread) || thread_is_event(thread), &lwi); - if (thread_test_and_clear_flags(thread, SVC_STOPPING)) { + if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - } else { - /* woken after adding import to reset timer */ - thread_test_and_clear_flags(thread, SVC_EVENT); - } + /* woken after adding import to reset timer */ + thread_test_and_clear_flags(thread, SVC_EVENT); } } -- 2.4.2 From antoniomurdaca at gmail.com Mon Jun 1 12:18:51 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 1 Jun 2015 14:18:51 +0200 Subject: [lustre-devel] [PATCH] staging: lustre: cleanup not needed else clauses Message-ID: <1433161131-25946-1-git-send-email-antonio.murdaca@gmail.com> cleanup checkpatch.pl warnings about not needed else clauses after a break or return Signed-off-by: Antonio Murdaca --- drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++- .../staging/lustre/lustre/include/lprocfs_status.h | 3 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 36 +++++++++++----------- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++--- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +- drivers/staging/lustre/lustre/lov/lov_request.c | 3 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++-- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- drivers/staging/lustre/lustre/osc/osc_request.c | 14 +++++---- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 ++--- 13 files changed, 50 insertions(+), 59 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 7aee393..d124727 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -201,10 +201,9 @@ static int seq_client_alloc_seq(const struct lu_env *env, CERROR("%s: Can't allocate new meta-sequence, rc %d\n", seq->lcs_name, rc); return rc; - } else { - CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", - seq->lcs_name, PRANGE(&seq->lcs_space)); } + CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", + seq->lcs_name, PRANGE(&seq->lcs_space)); } else { rc = 0; } diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index d030847..e423ade 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -422,9 +422,8 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, else spin_lock(&stats->ls_lock); return 1; - } else { - return stats->ls_biggest_alloc_num; } + return stats->ls_biggest_alloc_num; } } diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 19448fe..47aa8c4 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -836,25 +836,25 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, *exceed = 1; } return result; - } else { - /* - * region is within kms and, hence, within real file - * size (A). We need to increase i_size to cover the - * read region so that generic_file_read() will do its - * job, but that doesn't mean the kms size is - * _correct_, it is only the _minimum_ size. If - * someone does a stat they will get the correct size - * which will always be >= the kms value here. - * b=11081 - */ - if (cl_isize_read(inode) < kms) { - cl_isize_write_nolock(inode, kms); - CDEBUG(D_VFSTRACE, - DFID" updating i_size %llu\n", - PFID(lu_object_fid(&obj->co_lu)), - (__u64)cl_isize_read(inode)); + } + + /* + * region is within kms and, hence, within real file + * size (A). We need to increase i_size to cover the + * read region so that generic_file_read() will do its + * job, but that doesn't mean the kms size is + * _correct_, it is only the _minimum_ size. If + * someone does a stat they will get the correct size + * which will always be >= the kms value here. + * b=11081 + */ + if (cl_isize_read(inode) < kms) { + cl_isize_write_nolock(inode, kms); + CDEBUG(D_VFSTRACE, + DFID" updating i_size %llu\n", + PFID(lu_object_fid(&obj->co_lu)), + (__u64)cl_isize_read(inode)); - } } } ccc_object_size_unlock(obj); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 0a0b435..764f986 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -667,10 +667,9 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) DEBUG_REQ(D_NET, req, "processing error (%d)", rc); req->rq_status = rc; return ptlrpc_send_error(req, 1); - } else { - DEBUG_REQ(D_NET, req, "sending reply"); } + DEBUG_REQ(D_NET, req, "sending reply"); return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT); } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 6a22f41..bb2246d 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -931,7 +931,9 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else if (lock->l_resource->lr_type == LDLM_IBITS) { + } + + if (lock->l_resource->lr_type == LDLM_IBITS) { for (;;) { policy_end = list_entry(lock->l_sl_policy.prev, @@ -967,11 +969,10 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else { - LDLM_ERROR(lock, - "is not LDLM_PLAIN or LDLM_IBITS lock"); - LBUG(); } + + LDLM_ERROR(lock, "is not LDLM_PLAIN or LDLM_IBITS lock"); + LBUG(); } /* insert point is last lock on the queue, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 53e1377..ee3971e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1362,8 +1362,7 @@ static int ldlm_pools_thread_main(void *arg) if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - else - thread_test_and_clear_flags(thread, SVC_EVENT); + thread_test_and_clear_flags(thread, SVC_EVENT); } thread_set_flags(thread, SVC_STOPPED); diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index f6e1314..8fdfd68 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -617,8 +617,7 @@ void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs, if (tmp & 1) { if (quit) break; - else - quit = 1; + quit = 1; shift = 0; } tmp >>= 1; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index cbbdfce..539c31d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -75,11 +75,11 @@ static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, if (IS_ERR(c)) { CDEBUG(D_INFO, "alloc capa failed!\n"); return PTR_ERR(c); - } else { - c->c_capa = *capa; - *oc = c; - return 0; } + + c->c_capa = *capa; + *oc = c; + return 0; } static inline int mdc_queue_wait(struct ptlrpc_request *req) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index f13d1fb..163fe0c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -906,10 +906,8 @@ struct lu_env *cl_env_nested_get(struct cl_env_nest *nest) if (env != NULL) { if (!cl_io_is_going(env)) return env; - else { - cl_env_put(env, &nest->cen_refcheck); - nest->cen_cookie = cl_env_reenter(); - } + cl_env_put(env, &nest->cen_refcheck); + nest->cen_cookie = cl_env_reenter(); } env = cl_env_get(&nest->cen_refcheck); if (IS_ERR(env)) { diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c8f6ab0..48dbbcf 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -279,9 +279,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_read(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } up_read(&cathandle->lgh_lock); @@ -299,9 +298,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_write(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } CDEBUG(D_INODE, "use next log\n"); diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 350ad49..2516e2f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1176,8 +1176,7 @@ static int osc_lock_wait(const struct lu_env *env, /* It is from enqueue RPC reply upcall for * updating state. Do not re-enqueue. */ return -ENAVAIL; - else - olck->ols_state = OLS_NEW; + olck->ols_state = OLS_NEW; } else { LASSERT(lock->cll_error); return lock->cll_error; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index ded184e..065d8ff 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1007,8 +1007,8 @@ static int osc_should_shrink_grant(struct client_obd *client) if (client->cl_import->imp_state == LUSTRE_IMP_FULL && client->cl_avail_grant > brw_size) return 1; - else - osc_update_next_shrink(client); + + osc_update_next_shrink(client); } return 0; } @@ -2300,7 +2300,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, mode); LDLM_LOCK_PUT(matched); return -ECANCELED; - } else if (osc_set_lock_data_with_check(matched, einfo)) { + } + + if (osc_set_lock_data_with_check(matched, einfo)) { *flags |= LDLM_FL_LVB_READY; /* addref the lock only if not async requests and PW * lock is matched whereas we asked for PR. */ @@ -2325,10 +2327,10 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, einfo->ei_mode); LDLM_LOCK_PUT(matched); return ELDLM_OK; - } else { - ldlm_lock_decref(lockh, mode); - LDLM_LOCK_PUT(matched); } + + ldlm_lock_decref(lockh, mode); + LDLM_LOCK_PUT(matched); } no_match: diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 5abb91c..7106049 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -289,12 +289,10 @@ static int ptlrpc_pinger_main(void *arg) thread_is_stopping(thread) || thread_is_event(thread), &lwi); - if (thread_test_and_clear_flags(thread, SVC_STOPPING)) { + if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - } else { - /* woken after adding import to reset timer */ - thread_test_and_clear_flags(thread, SVC_EVENT); - } + /* woken after adding import to reset timer */ + thread_test_and_clear_flags(thread, SVC_EVENT); } } -- 2.4.2 From greg at kroah.com Mon Jun 1 12:07:03 2015 From: greg at kroah.com (Greg KH) Date: Mon, 1 Jun 2015 21:07:03 +0900 Subject: [lustre-devel] [PATCH] staging: lustre: cleanup not needed else clauses In-Reply-To: <1433143750-13904-1-git-send-email-antonio.murdaca@gmail.com> References: <1433143750-13904-1-git-send-email-antonio.murdaca@gmail.com> Message-ID: <20150601120703.GA6580@kroah.com> On Mon, Jun 01, 2015 at 09:29:10AM +0200, Antonio Murdaca wrote: > cleanup checkpatch.pl warnings about not needed else > clauses after a break or return > > Signed-off-by: Antonio Murdaca Any reason you sent 4 copies of this and didn't cc the driverdevel mailing list on any of them? Please fix that up and resend 1 copy, we get enough email as it is :) thanks, greg k-h From antoniomurdaca at gmail.com Mon Jun 1 07:24:50 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 1 Jun 2015 09:24:50 +0200 Subject: [lustre-devel] [PATCH] staging: lustre: cleanup not needed else clauses Message-ID: <1433143490-13482-1-git-send-email-antonio.murdaca@gmail.com> cleanup checkpatch.pl warnings about not needed else clauses after a break or return Signed-off-by: Antonio Murdaca --- drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++- .../staging/lustre/lustre/include/lprocfs_status.h | 3 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 36 +++++++++++----------- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++--- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +- drivers/staging/lustre/lustre/lov/lov_request.c | 3 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++-- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- drivers/staging/lustre/lustre/osc/osc_request.c | 14 +++++---- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 ++--- 13 files changed, 50 insertions(+), 59 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 7aee393..d124727 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -201,10 +201,9 @@ static int seq_client_alloc_seq(const struct lu_env *env, CERROR("%s: Can't allocate new meta-sequence, rc %d\n", seq->lcs_name, rc); return rc; - } else { - CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", - seq->lcs_name, PRANGE(&seq->lcs_space)); } + CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", + seq->lcs_name, PRANGE(&seq->lcs_space)); } else { rc = 0; } diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index d030847..e423ade 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -422,9 +422,8 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, else spin_lock(&stats->ls_lock); return 1; - } else { - return stats->ls_biggest_alloc_num; } + return stats->ls_biggest_alloc_num; } } diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 19448fe..47aa8c4 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -836,25 +836,25 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, *exceed = 1; } return result; - } else { - /* - * region is within kms and, hence, within real file - * size (A). We need to increase i_size to cover the - * read region so that generic_file_read() will do its - * job, but that doesn't mean the kms size is - * _correct_, it is only the _minimum_ size. If - * someone does a stat they will get the correct size - * which will always be >= the kms value here. - * b=11081 - */ - if (cl_isize_read(inode) < kms) { - cl_isize_write_nolock(inode, kms); - CDEBUG(D_VFSTRACE, - DFID" updating i_size %llu\n", - PFID(lu_object_fid(&obj->co_lu)), - (__u64)cl_isize_read(inode)); + } + + /* + * region is within kms and, hence, within real file + * size (A). We need to increase i_size to cover the + * read region so that generic_file_read() will do its + * job, but that doesn't mean the kms size is + * _correct_, it is only the _minimum_ size. If + * someone does a stat they will get the correct size + * which will always be >= the kms value here. + * b=11081 + */ + if (cl_isize_read(inode) < kms) { + cl_isize_write_nolock(inode, kms); + CDEBUG(D_VFSTRACE, + DFID" updating i_size %llu\n", + PFID(lu_object_fid(&obj->co_lu)), + (__u64)cl_isize_read(inode)); - } } } ccc_object_size_unlock(obj); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 0a0b435..764f986 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -667,10 +667,9 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) DEBUG_REQ(D_NET, req, "processing error (%d)", rc); req->rq_status = rc; return ptlrpc_send_error(req, 1); - } else { - DEBUG_REQ(D_NET, req, "sending reply"); } + DEBUG_REQ(D_NET, req, "sending reply"); return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT); } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 6a22f41..bb2246d 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -931,7 +931,9 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else if (lock->l_resource->lr_type == LDLM_IBITS) { + } + + if (lock->l_resource->lr_type == LDLM_IBITS) { for (;;) { policy_end = list_entry(lock->l_sl_policy.prev, @@ -967,11 +969,10 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else { - LDLM_ERROR(lock, - "is not LDLM_PLAIN or LDLM_IBITS lock"); - LBUG(); } + + LDLM_ERROR(lock, "is not LDLM_PLAIN or LDLM_IBITS lock"); + LBUG(); } /* insert point is last lock on the queue, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 53e1377..ee3971e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1362,8 +1362,7 @@ static int ldlm_pools_thread_main(void *arg) if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - else - thread_test_and_clear_flags(thread, SVC_EVENT); + thread_test_and_clear_flags(thread, SVC_EVENT); } thread_set_flags(thread, SVC_STOPPED); diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index f6e1314..8fdfd68 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -617,8 +617,7 @@ void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs, if (tmp & 1) { if (quit) break; - else - quit = 1; + quit = 1; shift = 0; } tmp >>= 1; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index cbbdfce..539c31d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -75,11 +75,11 @@ static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, if (IS_ERR(c)) { CDEBUG(D_INFO, "alloc capa failed!\n"); return PTR_ERR(c); - } else { - c->c_capa = *capa; - *oc = c; - return 0; } + + c->c_capa = *capa; + *oc = c; + return 0; } static inline int mdc_queue_wait(struct ptlrpc_request *req) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index f13d1fb..163fe0c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -906,10 +906,8 @@ struct lu_env *cl_env_nested_get(struct cl_env_nest *nest) if (env != NULL) { if (!cl_io_is_going(env)) return env; - else { - cl_env_put(env, &nest->cen_refcheck); - nest->cen_cookie = cl_env_reenter(); - } + cl_env_put(env, &nest->cen_refcheck); + nest->cen_cookie = cl_env_reenter(); } env = cl_env_get(&nest->cen_refcheck); if (IS_ERR(env)) { diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c8f6ab0..48dbbcf 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -279,9 +279,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_read(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } up_read(&cathandle->lgh_lock); @@ -299,9 +298,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_write(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } CDEBUG(D_INODE, "use next log\n"); diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 350ad49..2516e2f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1176,8 +1176,7 @@ static int osc_lock_wait(const struct lu_env *env, /* It is from enqueue RPC reply upcall for * updating state. Do not re-enqueue. */ return -ENAVAIL; - else - olck->ols_state = OLS_NEW; + olck->ols_state = OLS_NEW; } else { LASSERT(lock->cll_error); return lock->cll_error; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index ded184e..065d8ff 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1007,8 +1007,8 @@ static int osc_should_shrink_grant(struct client_obd *client) if (client->cl_import->imp_state == LUSTRE_IMP_FULL && client->cl_avail_grant > brw_size) return 1; - else - osc_update_next_shrink(client); + + osc_update_next_shrink(client); } return 0; } @@ -2300,7 +2300,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, mode); LDLM_LOCK_PUT(matched); return -ECANCELED; - } else if (osc_set_lock_data_with_check(matched, einfo)) { + } + + if (osc_set_lock_data_with_check(matched, einfo)) { *flags |= LDLM_FL_LVB_READY; /* addref the lock only if not async requests and PW * lock is matched whereas we asked for PR. */ @@ -2325,10 +2327,10 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, einfo->ei_mode); LDLM_LOCK_PUT(matched); return ELDLM_OK; - } else { - ldlm_lock_decref(lockh, mode); - LDLM_LOCK_PUT(matched); } + + ldlm_lock_decref(lockh, mode); + LDLM_LOCK_PUT(matched); } no_match: diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 5abb91c..7106049 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -289,12 +289,10 @@ static int ptlrpc_pinger_main(void *arg) thread_is_stopping(thread) || thread_is_event(thread), &lwi); - if (thread_test_and_clear_flags(thread, SVC_STOPPING)) { + if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - } else { - /* woken after adding import to reset timer */ - thread_test_and_clear_flags(thread, SVC_EVENT); - } + /* woken after adding import to reset timer */ + thread_test_and_clear_flags(thread, SVC_EVENT); } } -- 2.4.2 From antoniomurdaca at gmail.com Mon Jun 1 21:14:14 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 1 Jun 2015 23:14:14 +0200 Subject: [lustre-devel] [PATCH] staging: lustre: lov: remove unnecessary parentheses Message-ID: <1433193254-9211-1-git-send-email-antonio.murdaca@gmail.com> fix checkpatch.pl warning about unnecessary parentheses Signed-off-by: Antonio Murdaca --- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 054ca32..0a4f1771 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -1417,7 +1417,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, __u32 flags; memcpy(&index, data->ioc_inlbuf2, sizeof(__u32)); - if ((index >= count)) + if (index >= count) return -ENODEV; if (!lov->lov_tgts[index]) -- 2.4.2 From hannac at iu.edu Tue Jun 2 15:32:19 2015 From: hannac at iu.edu (Chris Hanna) Date: Tue, 2 Jun 2015 11:32:19 -0400 Subject: [lustre-devel] [PATCH resend] staging: lustre: osc: clean up whitespace and align function parameters Message-ID: <1433259139-11202-1-git-send-email-hannac@iu.edu> Signed-off-by: Chris Hanna Minor changes to remove excessive whitespace and improve readability of functions. --- Sending again due to tree mismatch. drivers/staging/lustre/lustre/osc/lproc_osc.c | 18 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 196 +++++++++++----------- drivers/staging/lustre/lustre/osc/osc_dev.c | 12 +- drivers/staging/lustre/lustre/osc/osc_io.c | 124 +++++++------- drivers/staging/lustre/lustre/osc/osc_lock.c | 148 +++++++++--------- drivers/staging/lustre/lustre/osc/osc_object.c | 18 +- drivers/staging/lustre/lustre/osc/osc_page.c | 38 +++--- drivers/staging/lustre/lustre/osc/osc_quota.c | 14 +- drivers/staging/lustre/lustre/osc/osc_request.c | 169 ++++++++++---------- 9 files changed, 368 insertions(+), 369 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 9dc84ba..ff6d2e2 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -417,8 +417,8 @@ static ssize_t osc_checksum_type_seq_write(struct file *file, LPROC_SEQ_FOPS(osc_checksum_type); static ssize_t resend_count_show(struct kobject *kobj, - struct attribute *attr, - char *buf) + struct attribute *attr, + char *buf) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kobj); @@ -427,9 +427,9 @@ static ssize_t resend_count_show(struct kobject *kobj, } static ssize_t resend_count_store(struct kobject *kobj, - struct attribute *attr, - const char *buffer, - size_t count) + struct attribute *attr, + const char *buffer, + size_t count) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kobj); @@ -682,8 +682,8 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) #undef pct static ssize_t osc_rpc_stats_seq_write(struct file *file, - const char __user *buf, - size_t len, loff_t *off) + const char __user *buf, + size_t len, loff_t *off) { struct seq_file *seq = file->private_data; struct obd_device *dev = seq->private; @@ -721,8 +721,8 @@ static int osc_stats_seq_show(struct seq_file *seq, void *v) } static ssize_t osc_stats_seq_write(struct file *file, - const char __user *buf, - size_t len, loff_t *off) + const char __user *buf, + size_t len, loff_t *off) { struct seq_file *seq = file->private_data; struct obd_device *dev = seq->private; diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index d44b3d4..5592d32 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -112,8 +112,8 @@ static const char *oes_strings[] = { /* ----- extent part 0 ----- */ \ __ext, EXTPARA(__ext), \ /* ----- part 1 ----- */ \ - atomic_read(&__ext->oe_refc), \ - atomic_read(&__ext->oe_users), \ + atomic_read(&__ext->oe_refc), \ + atomic_read(&__ext->oe_users), \ list_empty_marker(&__ext->oe_link), \ oes_strings[__ext->oe_state], ext_flags(__ext, __buf), \ __ext->oe_obj, \ @@ -297,12 +297,12 @@ out: #define sanity_check_nolock(ext) \ osc_extent_sanity_check0(ext, __func__, __LINE__) -#define sanity_check(ext) ({ \ - int __res; \ +#define sanity_check(ext) ({ \ + int __res; \ osc_object_lock((ext)->oe_obj); \ - __res = sanity_check_nolock(ext); \ - osc_object_unlock((ext)->oe_obj); \ - __res; \ + __res = sanity_check_nolock(ext); \ + osc_object_unlock((ext)->oe_obj); \ + __res; \ }) @@ -411,7 +411,7 @@ static void osc_extent_put_trust(struct osc_extent *ext) static struct osc_extent *osc_extent_search(struct osc_object *obj, pgoff_t index) { - struct rb_node *n = obj->oo_root.rb_node; + struct rb_node *n = obj->oo_root.rb_node; struct osc_extent *tmp, *p = NULL; LASSERT(osc_object_is_locked(obj)); @@ -447,8 +447,8 @@ static struct osc_extent *osc_extent_lookup(struct osc_object *obj, /* caller must have held object lock. */ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) { - struct rb_node **n = &obj->oo_root.rb_node; - struct rb_node *parent = NULL; + struct rb_node **n = &obj->oo_root.rb_node; + struct rb_node *parent = NULL; struct osc_extent *tmp; LASSERT(ext->oe_intree == 0); @@ -544,19 +544,19 @@ static int osc_extent_merge(const struct lu_env *env, struct osc_extent *cur, LASSERT(cur->oe_osclock == victim->oe_osclock); ppc_bits = osc_cli(obj)->cl_chunkbits - PAGE_CACHE_SHIFT; chunk_start = cur->oe_start >> ppc_bits; - chunk_end = cur->oe_end >> ppc_bits; - if (chunk_start != (victim->oe_end >> ppc_bits) + 1 && + chunk_end = cur->oe_end >> ppc_bits; + if (chunk_start != (victim->oe_end >> ppc_bits) + 1 && chunk_end + 1 != victim->oe_start >> ppc_bits) return -ERANGE; OSC_EXTENT_DUMP(D_CACHE, victim, "will be merged by %p.\n", cur); - cur->oe_start = min(cur->oe_start, victim->oe_start); - cur->oe_end = max(cur->oe_end, victim->oe_end); - cur->oe_grants += victim->oe_grants; + cur->oe_start = min(cur->oe_start, victim->oe_start); + cur->oe_end = max(cur->oe_end, victim->oe_end); + cur->oe_grants += victim->oe_grants; cur->oe_nr_pages += victim->oe_nr_pages; /* only the following bits are needed to merge */ - cur->oe_urgent |= victim->oe_urgent; + cur->oe_urgent |= victim->oe_urgent; cur->oe_memalloc |= victim->oe_memalloc; list_splice_init(&victim->oe_pages, &cur->oe_pages); list_del_init(&victim->oe_link); @@ -624,18 +624,18 @@ struct osc_extent *osc_extent_find(const struct lu_env *env, { struct client_obd *cli = osc_cli(obj); - struct cl_lock *lock; + struct cl_lock *lock; struct osc_extent *cur; struct osc_extent *ext; struct osc_extent *conflict = NULL; struct osc_extent *found = NULL; - pgoff_t chunk; - pgoff_t max_end; - int max_pages; /* max_pages_per_rpc */ - int chunksize; - int ppc_bits; /* pages per chunk bits */ - int chunk_mask; - int rc; + pgoff_t chunk; + pgoff_t max_end; + int max_pages; /* max_pages_per_rpc */ + int chunksize; + int ppc_bits; /* pages per chunk bits */ + int chunk_mask; + int rc; cur = osc_extent_alloc(obj); if (cur == NULL) @@ -646,10 +646,10 @@ struct osc_extent *osc_extent_find(const struct lu_env *env, LASSERT(lock->cll_descr.cld_mode >= CLM_WRITE); LASSERT(cli->cl_chunkbits >= PAGE_CACHE_SHIFT); - ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; + ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; chunk_mask = ~((1 << ppc_bits) - 1); - chunksize = 1 << cli->cl_chunkbits; - chunk = index >> ppc_bits; + chunksize = 1 << cli->cl_chunkbits; + chunk = index >> ppc_bits; /* align end to rpc edge, rpc size may not be a power 2 integer. */ max_pages = cli->cl_max_pages_per_rpc; @@ -659,15 +659,15 @@ struct osc_extent *osc_extent_find(const struct lu_env *env, /* initialize new extent by parameters so far */ cur->oe_max_end = max_end; - cur->oe_start = index & chunk_mask; - cur->oe_end = ((index + ~chunk_mask + 1) & chunk_mask) - 1; + cur->oe_start = index & chunk_mask; + cur->oe_end = ((index + ~chunk_mask + 1) & chunk_mask) - 1; if (cur->oe_start < lock->cll_descr.cld_start) cur->oe_start = lock->cll_descr.cld_start; if (cur->oe_end > max_end) cur->oe_end = max_end; cur->oe_osclock = lock; - cur->oe_grants = 0; - cur->oe_mppr = max_pages; + cur->oe_grants = 0; + cur->oe_mppr = max_pages; /* grants has been allocated by caller */ LASSERTF(*grants >= chunksize + cli->cl_extent_tax, @@ -681,7 +681,7 @@ restart: ext = first_extent(obj); while (ext != NULL) { loff_t ext_chk_start = ext->oe_start >> ppc_bits; - loff_t ext_chk_end = ext->oe_end >> ppc_bits; + loff_t ext_chk_end = ext->oe_end >> ppc_bits; LASSERT(sanity_check_nolock(ext) == 0); if (chunk > ext_chk_end + 1) @@ -755,14 +755,14 @@ restart: EASSERT((ext->oe_start & ~chunk_mask) == 0, ext); /* pull ext's start back to cover cur */ - ext->oe_start = cur->oe_start; + ext->oe_start = cur->oe_start; ext->oe_grants += chunksize; *grants -= chunksize; found = osc_extent_hold(ext); } else if (chunk == ext_chk_end + 1) { /* rear merge */ - ext->oe_end = cur->oe_end; + ext->oe_end = cur->oe_end; ext->oe_grants += chunksize; *grants -= chunksize; @@ -943,21 +943,21 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, * @size, then partial truncate happens. */ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, - bool partial) + bool partial) { - struct cl_env_nest nest; - struct lu_env *env; - struct cl_io *io; - struct osc_object *obj = ext->oe_obj; - struct client_obd *cli = osc_cli(obj); + struct cl_env_nest nest; + struct lu_env *env; + struct cl_io *io; + struct osc_object *obj = ext->oe_obj; + struct client_obd *cli = osc_cli(obj); struct osc_async_page *oap; struct osc_async_page *tmp; - int pages_in_chunk = 0; - int ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; - __u64 trunc_chunk = trunc_index >> ppc_bits; - int grants = 0; - int nr_pages = 0; - int rc = 0; + int pages_in_chunk = 0; + int ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; + __u64 trunc_chunk = trunc_index >> ppc_bits; + int grants = 0; + int nr_pages = 0; + int rc = 0; LASSERT(sanity_check(ext) == 0); EASSERT(ext->oe_state == OES_TRUNC, ext); @@ -976,8 +976,8 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, /* discard all pages with index greater then trunc_index */ list_for_each_entry_safe(oap, tmp, &ext->oe_pages, oap_pending_item) { - struct cl_page *sub = oap2cl_page(oap); - struct cl_page *page = cl_page_top(sub); + struct cl_page *sub = oap2cl_page(oap); + struct cl_page *page = cl_page_top(sub); LASSERT(list_empty(&oap->oap_rpc_item)); @@ -1022,7 +1022,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, grants = ext->oe_grants; ext->oe_grants = 0; } else { /* calculate how many grants we can free */ - int chunks = (ext->oe_end >> ppc_bits) - trunc_chunk; + int chunks = (ext->oe_end >> ppc_bits) - trunc_chunk; pgoff_t last_index; @@ -1038,10 +1038,10 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, } /* this is what we can free from this extent */ - grants = chunks << cli->cl_chunkbits; + grants = chunks << cli->cl_chunkbits; ext->oe_grants -= grants; - last_index = ((trunc_chunk + 1) << ppc_bits) - 1; - ext->oe_end = min(last_index, ext->oe_max_end); + last_index = ((trunc_chunk + 1) << ppc_bits) - 1; + ext->oe_end = min(last_index, ext->oe_max_end); LASSERT(ext->oe_end >= ext->oe_start); LASSERT(ext->oe_grants > 0); } @@ -1236,8 +1236,8 @@ static inline int osc_is_ready(struct osc_object *osc) static int osc_make_ready(const struct lu_env *env, struct osc_async_page *oap, int cmd) { - struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = cl_page_top(oap2cl_page(oap)); + struct osc_page *opg = oap2osc_page(oap); + struct cl_page *page = cl_page_top(oap2cl_page(oap)); int result; LASSERT(cmd == OBD_BRW_WRITE); /* no cached reads */ @@ -1251,10 +1251,10 @@ static int osc_make_ready(const struct lu_env *env, struct osc_async_page *oap, static int osc_refresh_count(const struct lu_env *env, struct osc_async_page *oap, int cmd) { - struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = oap2cl_page(oap); + struct osc_page *opg = oap2osc_page(oap); + struct cl_page *page = oap2cl_page(oap); struct cl_object *obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int result; loff_t kms; @@ -1283,10 +1283,10 @@ static int osc_refresh_count(const struct lu_env *env, static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, int cmd, int rc) { - struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = cl_page_top(oap2cl_page(oap)); - struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); - enum cl_req_type crt; + struct osc_page *opg = oap2osc_page(oap); + struct cl_page *page = cl_page_top(oap2cl_page(oap)); + struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); + enum cl_req_type crt; int srvlock; cmd &= ~OBD_BRW_NOQUOTA; @@ -1318,7 +1318,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, /* statistic */ if (rc == 0 && srvlock) { - struct lu_device *ld = opg->ops_cl.cpl_obj->co_lu.lo_dev; + struct lu_device *ld = opg->ops_cl.cpl_obj->co_lu.lo_dev; struct osc_stats *stats = &lu2osc_dev(ld)->od_stats; int bytes = oap->oap_count; @@ -1396,7 +1396,7 @@ static int osc_reserve_grant(struct client_obd *cli, unsigned int bytes) int rc = -EDQUOT; if (cli->cl_avail_grant >= bytes) { - cli->cl_avail_grant -= bytes; + cli->cl_avail_grant -= bytes; cli->cl_reserved_grant += bytes; rc = 0; } @@ -1527,7 +1527,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, struct osc_async_page *oap, int bytes) { struct osc_object *osc = oap->oap_obj; - struct lov_oinfo *loi = osc->oo_oinfo; + struct lov_oinfo *loi = osc->oo_oinfo; struct osc_cache_waiter ocw; struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); int rc = -EDQUOT; @@ -1782,7 +1782,7 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, struct osc_async_page *oap, int sent, int rc) { struct osc_object *osc = oap->oap_obj; - struct lov_oinfo *loi = osc->oo_oinfo; + struct lov_oinfo *loi = osc->oo_oinfo; __u64 xid = 0; if (oap->oap_request != NULL) { @@ -2049,7 +2049,7 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, #define list_to_obj(list, item) ({ \ struct list_head *__tmp = (list)->next; \ - list_del_init(__tmp); \ + list_del_init(__tmp); \ list_entry(__tmp, struct osc_object, oo_##item); \ }) @@ -2179,7 +2179,7 @@ static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, } static int osc_io_unplug_async(const struct lu_env *env, - struct client_obd *cli, struct osc_object *osc) + struct client_obd *cli, struct osc_object *osc) { /* XXX: policy is no use actually. */ return osc_io_unplug0(env, cli, osc, PDL_POLICY_ROUND, 1); @@ -2194,7 +2194,7 @@ void osc_io_unplug(const struct lu_env *env, struct client_obd *cli, int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, struct page *page, loff_t offset) { - struct obd_export *exp = osc_export(osc); + struct obd_export *exp = osc_export(osc); struct osc_async_page *oap = &ops->ops_oap; if (!page) @@ -2224,16 +2224,16 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, struct osc_page *ops) { struct osc_io *oio = osc_env_io(env); - struct osc_extent *ext = NULL; + struct osc_extent *ext = NULL; struct osc_async_page *oap = &ops->ops_oap; - struct client_obd *cli = oap->oap_cli; - struct osc_object *osc = oap->oap_obj; + struct client_obd *cli = oap->oap_cli; + struct osc_object *osc = oap->oap_obj; pgoff_t index; - int grants = 0; - int brw_flags = OBD_BRW_ASYNC; - int cmd = OBD_BRW_WRITE; - int need_release = 0; - int rc = 0; + int grants = 0; + int brw_flags = OBD_BRW_ASYNC; + int cmd = OBD_BRW_WRITE; + int need_release = 0; + int rc = 0; if (oap->oap_magic != OAP_MAGIC) return -EINVAL; @@ -2256,7 +2256,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, /* check if the file's owner/group is over quota */ if (!(cmd & OBD_BRW_NOQUOTA)) { struct cl_object *obj; - struct cl_attr *attr; + struct cl_attr *attr; unsigned int qid[MAXQUOTAS]; obj = cl_object_top(&osc->oo_cl); @@ -2386,7 +2386,7 @@ int osc_teardown_async_page(const struct lu_env *env, struct osc_object *obj, struct osc_page *ops) { struct osc_async_page *oap = &ops->ops_oap; - struct osc_extent *ext = NULL; + struct osc_extent *ext = NULL; int rc = 0; LASSERT(oap->oap_magic == OAP_MAGIC); @@ -2425,10 +2425,10 @@ int osc_teardown_async_page(const struct lu_env *env, int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, struct osc_page *ops) { - struct osc_extent *ext = NULL; - struct osc_object *obj = cl2osc(ops->ops_cl.cpl_obj); - struct cl_page *cp = ops->ops_cl.cpl_page; - pgoff_t index = cp->cp_index; + struct osc_extent *ext = NULL; + struct osc_object *obj = cl2osc(ops->ops_cl.cpl_obj); + struct cl_page *cp = ops->ops_cl.cpl_page; + pgoff_t index = cp->cp_index; struct osc_async_page *oap = &ops->ops_oap; bool unplug = false; int rc = 0; @@ -2507,14 +2507,14 @@ out: int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) { struct osc_async_page *oap = &ops->ops_oap; - struct osc_object *obj = oap->oap_obj; - struct client_obd *cli = osc_cli(obj); - struct osc_extent *ext; - struct osc_extent *found = NULL; - struct list_head *plist; + struct osc_object *obj = oap->oap_obj; + struct client_obd *cli = osc_cli(obj); + struct osc_extent *ext; + struct osc_extent *found = NULL; + struct list_head *plist; pgoff_t index = oap2cl_page(oap)->cp_index; - int rc = -EBUSY; - int cmd; + int rc = -EBUSY; + int cmd; LASSERT(!oap->oap_interrupted); oap->oap_interrupted = 1; @@ -2523,10 +2523,10 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) osc_object_lock(obj); if (oap->oap_cmd & OBD_BRW_WRITE) { plist = &obj->oo_urgent_exts; - cmd = OBD_BRW_WRITE; + cmd = OBD_BRW_WRITE; } else { plist = &obj->oo_reading_exts; - cmd = OBD_BRW_READ; + cmd = OBD_BRW_READ; } list_for_each_entry(ext, plist, oe_link) { if (ext->oe_start <= index && ext->oe_end >= index) { @@ -2564,13 +2564,13 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, struct list_head *list, int cmd, int brw_flags) { - struct client_obd *cli = osc_cli(obj); - struct osc_extent *ext; + struct client_obd *cli = osc_cli(obj); + struct osc_extent *ext; struct osc_async_page *oap, *tmp; - int page_count = 0; - int mppr = cli->cl_max_pages_per_rpc; - pgoff_t start = CL_PAGE_EOF; - pgoff_t end = 0; + int page_count = 0; + int mppr = cli->cl_max_pages_per_rpc; + pgoff_t start = CL_PAGE_EOF; + pgoff_t end = 0; list_for_each_entry(oap, list, oap_pending_item) { struct cl_page *cp = oap2cl_page(oap); @@ -2785,7 +2785,7 @@ int osc_cache_wait_range(const struct lu_env *env, struct osc_object *obj, { struct osc_extent *ext; pgoff_t index = start; - int result = 0; + int result = 0; again: osc_object_lock(obj); diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index ce5c3af..9222c9f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -118,7 +118,7 @@ static struct lu_device *osc2lu_dev(struct osc_device *osc) */ static void *osc_key_init(const struct lu_context *ctx, - struct lu_context_key *key) + struct lu_context_key *key) { struct osc_thread_info *info; @@ -248,14 +248,14 @@ static const struct lu_device_type_operations osc_device_type_ops = { .ldto_device_alloc = osc_device_alloc, .ldto_device_free = osc_device_free, - .ldto_device_init = osc_device_init, - .ldto_device_fini = osc_device_fini + .ldto_device_init = osc_device_init, + .ldto_device_fini = osc_device_fini }; struct lu_device_type osc_device_type = { - .ldt_tags = LU_DEVICE_CL, - .ldt_name = LUSTRE_OSC_NAME, - .ldt_ops = &osc_device_type_ops, + .ldt_tags = LU_DEVICE_CL, + .ldt_name = LUSTRE_OSC_NAME, + .ldt_ops = &osc_device_type_ops, .ldt_ctx_tags = LCT_CL_THREAD }; diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 3c7300b..fa24e9e 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -100,16 +100,16 @@ static int osc_io_submit(const struct lu_env *env, const struct cl_io_slice *ios, enum cl_req_type crt, struct cl_2queue *queue) { - struct cl_page *page; - struct cl_page *tmp; - struct client_obd *cli = NULL; - struct osc_object *osc = NULL; /* to keep gcc happy */ - struct osc_page *opg; - struct cl_io *io; + struct cl_page *page; + struct cl_page *tmp; + struct client_obd *cli = NULL; + struct osc_object *osc = NULL; /* to keep gcc happy */ + struct osc_page *opg; + struct cl_io *io; LIST_HEAD(list); - struct cl_page_list *qin = &queue->c2_qin; - struct cl_page_list *qout = &queue->c2_qout; + struct cl_page_list *qin = &queue->c2_qin; + struct cl_page_list *qout = &queue->c2_qout; int queued = 0; int result = 0; int cmd; @@ -189,8 +189,8 @@ static int osc_io_submit(const struct lu_env *env, static void osc_page_touch_at(const struct lu_env *env, struct cl_object *obj, pgoff_t idx, unsigned to) { - struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int valid; __u64 kms; @@ -233,8 +233,8 @@ static void osc_page_touch_at(const struct lu_env *env, static void osc_page_touch(const struct lu_env *env, struct osc_page *opage, unsigned to) { - struct cl_page *page = opage->ops_cl.cpl_page; - struct cl_object *obj = opage->ops_cl.cpl_obj; + struct cl_page *page = opage->ops_cl.cpl_page; + struct cl_object *obj = opage->ops_cl.cpl_obj; osc_page_touch_at(env, obj, page->cp_index, to); } @@ -260,7 +260,7 @@ static int osc_io_prepare_write(const struct lu_env *env, { struct osc_device *dev = lu2osc_dev(slice->cpl_obj->co_lu.lo_dev); struct obd_import *imp = class_exp2cliimp(dev->od_exp); - struct osc_io *oio = cl2osc_io(env, ios); + struct osc_io *oio = cl2osc_io(env, ios); int result = 0; /* @@ -284,9 +284,9 @@ static int osc_io_commit_write(const struct lu_env *env, const struct cl_page_slice *slice, unsigned from, unsigned to) { - struct osc_io *oio = cl2osc_io(env, ios); - struct osc_page *opg = cl2osc_page(slice); - struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); + struct osc_io *oio = cl2osc_io(env, ios); + struct osc_page *opg = cl2osc_page(slice); + struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); struct osc_async_page *oap = &opg->ops_oap; LASSERT(to > 0); @@ -311,10 +311,10 @@ static int osc_io_commit_write(const struct lu_env *env, static int osc_io_fault_start(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io; + struct cl_io *io; struct cl_fault_io *fio; - io = ios->cis_io; + io = ios->cis_io; fio = &io->u.ci_fault; CDEBUG(D_INFO, "%lu %d %d\n", fio->ft_index, fio->ft_writable, fio->ft_nob); @@ -375,11 +375,11 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, struct osc_io *oio, __u64 size) { struct cl_object *clob; - int partial; + int partial; pgoff_t start; - clob = oio->oi_cl.cis_obj; - start = cl_index(clob, size); + clob = oio->oi_cl.cis_obj; + start = cl_index(clob, size); partial = cl_offset(clob, start) < size; /* @@ -392,17 +392,17 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, static int osc_io_setattr_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_io *io = slice->cis_io; - struct osc_io *oio = cl2osc_io(env, slice); - struct cl_object *obj = slice->cis_obj; - struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; - struct obdo *oa = &oio->oi_oa; + struct cl_io *io = slice->cis_io; + struct osc_io *oio = cl2osc_io(env, slice); + struct cl_object *obj = slice->cis_obj; + struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct obdo *oa = &oio->oi_oa; struct osc_async_cbargs *cbargs = &oio->oi_cbarg; - __u64 size = io->u.ci_setattr.sa_attr.lvb_size; - unsigned int ia_valid = io->u.ci_setattr.sa_valid; - int result = 0; - struct obd_info oinfo = { { { 0 } } }; + __u64 size = io->u.ci_setattr.sa_attr.lvb_size; + unsigned int ia_valid = io->u.ci_setattr.sa_valid; + int result = 0; + struct obd_info oinfo = { { { 0 } } }; /* truncate cache dirty pages first */ if (cl_io_is_trunc(io)) @@ -477,8 +477,8 @@ static int osc_io_setattr_start(const struct lu_env *env, static void osc_io_setattr_end(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_io *io = slice->cis_io; - struct osc_io *oio = cl2osc_io(env, slice); + struct cl_io *io = slice->cis_io; + struct osc_io *oio = cl2osc_io(env, slice); struct cl_object *obj = slice->cis_obj; struct osc_async_cbargs *cbargs = &oio->oi_cbarg; int result = 0; @@ -512,8 +512,8 @@ static void osc_io_setattr_end(const struct lu_env *env, static int osc_io_read_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_object *obj = slice->cis_obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_object *obj = slice->cis_obj; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int rc = 0; if (!slice->cis_io->ci_noatime) { @@ -528,8 +528,8 @@ static int osc_io_read_start(const struct lu_env *env, static int osc_io_write_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_object *obj = slice->cis_obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_object *obj = slice->cis_obj; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int rc = 0; OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1); @@ -544,10 +544,10 @@ static int osc_io_write_start(const struct lu_env *env, static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj, struct cl_fsync_io *fio) { - struct osc_io *oio = osc_env_io(env); - struct obdo *oa = &oio->oi_oa; - struct obd_info *oinfo = &oio->oi_info; - struct lov_oinfo *loi = obj->oo_oinfo; + struct osc_io *oio = osc_env_io(env); + struct obdo *oa = &oio->oi_oa; + struct obd_info *oinfo = &oio->oi_info; + struct lov_oinfo *loi = obj->oo_oinfo; struct osc_async_cbargs *cbargs = &oio->oi_cbarg; int rc = 0; @@ -575,13 +575,13 @@ static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj, static int osc_io_fsync_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_io *io = slice->cis_io; + struct cl_io *io = slice->cis_io; struct cl_fsync_io *fio = &io->u.ci_fsync; - struct cl_object *obj = slice->cis_obj; - struct osc_object *osc = cl2osc(obj); - pgoff_t start = cl_index(obj, fio->fi_start); - pgoff_t end = cl_index(obj, fio->fi_end); - int result = 0; + struct cl_object *obj = slice->cis_obj; + struct osc_object *osc = cl2osc(obj); + pgoff_t start = cl_index(obj, fio->fi_start); + pgoff_t end = cl_index(obj, fio->fi_end); + int result = 0; if (fio->fi_end == OBD_OBJECT_EOF) end = CL_PAGE_EOF; @@ -615,15 +615,15 @@ static void osc_io_fsync_end(const struct lu_env *env, const struct cl_io_slice *slice) { struct cl_fsync_io *fio = &slice->cis_io->u.ci_fsync; - struct cl_object *obj = slice->cis_obj; + struct cl_object *obj = slice->cis_obj; pgoff_t start = cl_index(obj, fio->fi_start); - pgoff_t end = cl_index(obj, fio->fi_end); + pgoff_t end = cl_index(obj, fio->fi_end); int result = 0; if (fio->fi_mode == CL_FSYNC_LOCAL) { result = osc_cache_wait_range(env, cl2osc(obj), start, end); } else if (fio->fi_mode == CL_FSYNC_ALL) { - struct osc_io *oio = cl2osc_io(env, slice); + struct osc_io *oio = cl2osc_io(env, slice); struct osc_async_cbargs *cbargs = &oio->oi_cbarg; wait_for_completion(&cbargs->opc_sync); @@ -717,17 +717,17 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_req_attr *attr, u64 flags) { struct lov_oinfo *oinfo; - struct cl_req *clerq; - struct cl_page *apage; /* _some_ page in @clerq */ - struct cl_lock *lock; /* _some_ lock protecting @apage */ - struct osc_lock *olck; - struct osc_page *opg; - struct obdo *oa; - struct ost_lvb *lvb; - - oinfo = cl2osc(obj)->oo_oinfo; - lvb = &oinfo->loi_lvb; - oa = attr->cra_oa; + struct cl_req *clerq; + struct cl_page *apage; /* _some_ page in @clerq */ + struct cl_lock *lock; /* _some_ lock protecting @apage */ + struct osc_lock *olck; + struct osc_page *opg; + struct obdo *oa; + struct ost_lvb *lvb; + + oinfo = cl2osc(obj)->oo_oinfo; + lvb = &oinfo->loi_lvb; + oa = attr->cra_oa; if ((flags & OBD_MD_FLMTIME) != 0) { oa->o_mtime = lvb->lvb_mtime; @@ -759,7 +759,7 @@ static void osc_req_attr_set(const struct lu_env *env, lock = cl_lock_at_page(env, apage->cp_obj, apage, NULL, 1, 1); if (lock == NULL) { struct cl_object_header *head; - struct cl_lock *scan; + struct cl_lock *scan; head = cl_object_header(apage->cp_obj); list_for_each_entry(scan, &head->coh_locks, diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 350ad49..06837f5 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -89,9 +89,9 @@ static struct ldlm_lock *osc_handle_ptr(struct lustre_handle *handle) */ static int osc_lock_invariant(struct osc_lock *ols) { - struct ldlm_lock *lock = osc_handle_ptr(&ols->ols_handle); - struct ldlm_lock *olock = ols->ols_lock; - int handle_used = lustre_handle_is_used(&ols->ols_handle); + struct ldlm_lock *lock = osc_handle_ptr(&ols->ols_handle); + struct ldlm_lock *olock = ols->ols_lock; + int handle_used = lustre_handle_is_used(&ols->ols_handle); if (ergo(osc_lock_is_lockless(ols), ols->ols_locklessable && ols->ols_lock == NULL)) @@ -164,7 +164,7 @@ static void osc_lock_detach(const struct lu_env *env, struct osc_lock *olck) lock_res_and_lock(dlmlock); if (dlmlock->l_granted_mode == dlmlock->l_req_mode) { struct cl_object *obj = olck->ols_cl.cls_obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; __u64 old_kms; cl_object_attr_lock(obj); @@ -237,7 +237,7 @@ static int osc_lock_unuse(const struct lu_env *env, static void osc_lock_fini(const struct lu_env *env, struct cl_lock_slice *slice) { - struct osc_lock *ols = cl2osc_lock(slice); + struct osc_lock *ols = cl2osc_lock(slice); LINVRNT(osc_lock_invariant(ols)); /* @@ -337,25 +337,25 @@ static void osc_ast_data_put(const struct lu_env *env, struct osc_lock *olck) static void osc_lock_lvb_update(const struct lu_env *env, struct osc_lock *olck, int rc) { - struct ost_lvb *lvb; - struct cl_object *obj; - struct lov_oinfo *oinfo; - struct cl_attr *attr; - unsigned valid; + struct ost_lvb *lvb; + struct cl_object *obj; + struct lov_oinfo *oinfo; + struct cl_attr *attr; + unsigned valid; if (!(olck->ols_flags & LDLM_FL_LVB_READY)) return; - lvb = &olck->ols_lvb; - obj = olck->ols_cl.cls_obj; + lvb = &olck->ols_lvb; + obj = olck->ols_cl.cls_obj; oinfo = cl2osc(obj)->oo_oinfo; - attr = &osc_env_info(env)->oti_attr; + attr = &osc_env_info(env)->oti_attr; valid = CAT_BLOCKS | CAT_ATIME | CAT_CTIME | CAT_MTIME | CAT_SIZE; cl_lvb2attr(attr, lvb); cl_object_attr_lock(obj); if (rc == 0) { - struct ldlm_lock *dlmlock; + struct ldlm_lock *dlmlock; __u64 size; dlmlock = olck->ols_lock; @@ -401,23 +401,23 @@ static void osc_lock_lvb_update(const struct lu_env *env, struct osc_lock *olck, static void osc_lock_granted(const struct lu_env *env, struct osc_lock *olck, struct ldlm_lock *dlmlock, int rc) { - struct ldlm_extent *ext; - struct cl_lock *lock; + struct ldlm_extent *ext; + struct cl_lock *lock; struct cl_lock_descr *descr; LASSERT(dlmlock->l_granted_mode == dlmlock->l_req_mode); if (olck->ols_state < OLS_GRANTED) { - lock = olck->ols_cl.cls_lock; - ext = &dlmlock->l_policy_data.l_extent; + lock = olck->ols_cl.cls_lock; + ext = &dlmlock->l_policy_data.l_extent; descr = &osc_env_info(env)->oti_descr; descr->cld_obj = lock->cll_descr.cld_obj; /* XXX check that ->l_granted_mode is valid. */ - descr->cld_mode = osc_ldlm2cl_lock(dlmlock->l_granted_mode); + descr->cld_mode = osc_ldlm2cl_lock(dlmlock->l_granted_mode); descr->cld_start = cl_index(descr->cld_obj, ext->start); - descr->cld_end = cl_index(descr->cld_obj, ext->end); - descr->cld_gid = ext->gid; + descr->cld_end = cl_index(descr->cld_obj, ext->end); + descr->cld_gid = ext->gid; /* * tell upper layers the extent of the lock that was actually * granted @@ -482,11 +482,11 @@ static void osc_lock_upcall0(const struct lu_env *env, struct osc_lock *olck) */ static int osc_lock_upcall(void *cookie, int errcode) { - struct osc_lock *olck = cookie; - struct cl_lock_slice *slice = &olck->ols_cl; - struct cl_lock *lock = slice->cls_lock; - struct lu_env *env; - struct cl_env_nest nest; + struct osc_lock *olck = cookie; + struct cl_lock_slice *slice = &olck->ols_cl; + struct cl_lock *lock = slice->cls_lock; + struct lu_env *env; + struct cl_env_nest nest; env = cl_env_nested_get(&nest); if (!IS_ERR(env)) { @@ -626,7 +626,7 @@ static int osc_dlm_blocking_ast0(const struct lu_env *env, void *data, int flag) { struct osc_lock *olck; - struct cl_lock *lock; + struct cl_lock *lock; int result; int cancel; @@ -733,9 +733,9 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, struct ldlm_lock_desc *new, void *data, int flag) { - struct lu_env *env; + struct lu_env *env; struct cl_env_nest nest; - int result; + int result; /* * This can be called in the context of outer IO, e.g., @@ -774,9 +774,9 @@ static int osc_ldlm_completion_ast(struct ldlm_lock *dlmlock, __u64 flags, void *data) { struct cl_env_nest nest; - struct lu_env *env; - struct osc_lock *olck; - struct cl_lock *lock; + struct lu_env *env; + struct osc_lock *olck; + struct cl_lock *lock; int result; int dlmrc; @@ -830,15 +830,15 @@ static int osc_ldlm_completion_ast(struct ldlm_lock *dlmlock, static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) { - struct ptlrpc_request *req = data; + struct ptlrpc_request *req = data; struct osc_lock *olck; - struct cl_lock *lock; - struct cl_object *obj; - struct cl_env_nest nest; - struct lu_env *env; - struct ost_lvb *lvb; - struct req_capsule *cap; - int result; + struct cl_lock *lock; + struct cl_object *obj; + struct cl_env_nest nest; + struct lu_env *env; + struct ost_lvb *lvb; + struct req_capsule *cap; + int result; LASSERT(lustre_msg_get_opc(req->rq_reqmsg) == LDLM_GL_CALLBACK); @@ -916,11 +916,11 @@ static void osc_lock_build_einfo(const struct lu_env *env, */ mode = CLM_READ; - einfo->ei_type = LDLM_EXTENT; - einfo->ei_mode = osc_cl_lock2ldlm(mode); - einfo->ei_cb_bl = osc_ldlm_blocking_ast; - einfo->ei_cb_cp = osc_ldlm_completion_ast; - einfo->ei_cb_gl = osc_ldlm_glimpse_ast; + einfo->ei_type = LDLM_EXTENT; + einfo->ei_mode = osc_cl_lock2ldlm(mode); + einfo->ei_cb_bl = osc_ldlm_blocking_ast; + einfo->ei_cb_cp = osc_ldlm_completion_ast; + einfo->ei_cb_gl = osc_ldlm_glimpse_ast; einfo->ei_cbdata = lock; /* value to be put into ->l_ast_data */ } @@ -948,9 +948,9 @@ static void osc_lock_to_lockless(const struct lu_env *env, ols->ols_locklessable = 1; slice->cls_ops = &osc_lock_lockless_ops; } else { - struct osc_io *oio = osc_env_io(env); - struct cl_io *io = oio->oi_cl.cis_io; - struct cl_object *obj = slice->cls_obj; + struct osc_io *oio = osc_env_io(env); + struct cl_io *io = oio->oi_cl.cis_io; + struct cl_object *obj = slice->cls_obj; struct osc_object *oob = cl2osc(obj); const struct osc_device *osd = lu2osc_dev(obj->co_lu.lo_dev); struct obd_connect_data *ocd; @@ -1006,13 +1006,13 @@ static int osc_lock_compatible(const struct osc_lock *qing, static int osc_lock_enqueue_wait(const struct lu_env *env, const struct osc_lock *olck) { - struct cl_lock *lock = olck->ols_cl.cls_lock; - struct cl_lock_descr *descr = &lock->cll_descr; - struct cl_object_header *hdr = cl_object_header(descr->cld_obj); - struct cl_lock *scan; - struct cl_lock *conflict = NULL; - int lockless = osc_lock_is_lockless(olck); - int rc = 0; + struct cl_lock *lock = olck->ols_cl.cls_lock; + struct cl_lock_descr *descr = &lock->cll_descr; + struct cl_object_header *hdr = cl_object_header(descr->cld_obj); + struct cl_lock *scan; + struct cl_lock *conflict = NULL; + int lockless = osc_lock_is_lockless(olck); + int rc = 0; LASSERT(cl_lock_is_mutexed(lock)); @@ -1102,8 +1102,8 @@ static int osc_lock_enqueue(const struct lu_env *env, const struct cl_lock_slice *slice, struct cl_io *unused, __u32 enqflags) { - struct osc_lock *ols = cl2osc_lock(slice); - struct cl_lock *lock = ols->ols_cl.cls_lock; + struct osc_lock *ols = cl2osc_lock(slice); + struct cl_lock *lock = ols->ols_cl.cls_lock; int result; LASSERT(cl_lock_is_mutexed(lock)); @@ -1116,10 +1116,10 @@ static int osc_lock_enqueue(const struct lu_env *env, result = osc_lock_enqueue_wait(env, ols); if (result == 0) { if (!osc_lock_is_lockless(ols)) { - struct osc_object *obj = cl2osc(slice->cls_obj); - struct osc_thread_info *info = osc_env_info(env); - struct ldlm_res_id *resname = &info->oti_resname; - ldlm_policy_data_t *policy = &info->oti_policy; + struct osc_object *obj = cl2osc(slice->cls_obj); + struct osc_thread_info *info = osc_env_info(env); + struct ldlm_res_id *resname = &info->oti_resname; + ldlm_policy_data_t *policy = &info->oti_policy; struct ldlm_enqueue_info *einfo = &ols->ols_einfo; /* lock will be passed as upcall cookie, @@ -1164,7 +1164,7 @@ static int osc_lock_wait(const struct lu_env *env, const struct cl_lock_slice *slice) { struct osc_lock *olck = cl2osc_lock(slice); - struct cl_lock *lock = olck->ols_cl.cls_lock; + struct cl_lock *lock = olck->ols_cl.cls_lock; LINVRNT(osc_lock_invariant(olck)); @@ -1245,14 +1245,14 @@ static int osc_lock_use(const struct lu_env *env, static int osc_lock_flush(struct osc_lock *ols, int discard) { - struct cl_lock *lock = ols->ols_cl.cls_lock; - struct cl_env_nest nest; - struct lu_env *env; + struct cl_lock *lock = ols->ols_cl.cls_lock; + struct cl_env_nest nest; + struct lu_env *env; int result = 0; env = cl_env_nested_get(&nest); if (!IS_ERR(env)) { - struct osc_object *obj = cl2osc(ols->ols_cl.cls_obj); + struct osc_object *obj = cl2osc(ols->ols_cl.cls_obj); struct cl_lock_descr *descr = &lock->cll_descr; int rc = 0; @@ -1298,11 +1298,11 @@ static int osc_lock_flush(struct osc_lock *ols, int discard) static void osc_lock_cancel(const struct lu_env *env, const struct cl_lock_slice *slice) { - struct cl_lock *lock = slice->cls_lock; - struct osc_lock *olck = cl2osc_lock(slice); + struct cl_lock *lock = slice->cls_lock; + struct osc_lock *olck = cl2osc_lock(slice); struct ldlm_lock *dlmlock = olck->ols_lock; - int result = 0; - int discard; + int result = 0; + int discard; LASSERT(cl_lock_is_mutexed(lock)); LINVRNT(osc_lock_invariant(olck)); @@ -1482,7 +1482,7 @@ static int osc_lock_lockless_unuse(const struct lu_env *env, static void osc_lock_lockless_cancel(const struct lu_env *env, const struct cl_lock_slice *slice) { - struct osc_lock *ols = cl2osc_lock(slice); + struct osc_lock *ols = cl2osc_lock(slice); int result; result = osc_lock_flush(ols, 0); @@ -1496,7 +1496,7 @@ static int osc_lock_lockless_wait(const struct lu_env *env, const struct cl_lock_slice *slice) { struct osc_lock *olck = cl2osc_lock(slice); - struct cl_lock *lock = olck->ols_cl.cls_lock; + struct cl_lock *lock = olck->ols_cl.cls_lock; LINVRNT(osc_lock_invariant(olck)); LASSERT(olck->ols_state >= OLS_UPCALL_RECEIVED); @@ -1512,7 +1512,7 @@ static void osc_lock_lockless_state(const struct lu_env *env, LINVRNT(osc_lock_invariant(lock)); if (state == CLS_HELD) { - struct osc_io *oio = osc_env_io(env); + struct osc_io *oio = osc_env_io(env); LASSERT(ergo(lock->ols_owner, lock->ols_owner == oio)); lock->ols_owner = oio; @@ -1591,7 +1591,7 @@ int osc_lock_init(const struct lu_env *env, int osc_dlm_lock_pageref(struct ldlm_lock *dlm) { struct osc_lock *olock; - int rc = 0; + int rc = 0; spin_lock(&osc_ast_guard); olock = dlm->l_ast_data; diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index 92c202f..c628a25 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -72,7 +72,7 @@ static struct osc_object *lu2osc(const struct lu_object *obj) static int osc_object_init(const struct lu_env *env, struct lu_object *obj, const struct lu_object_conf *conf) { - struct osc_object *osc = lu2osc(obj); + struct osc_object *osc = lu2osc(obj); const struct cl_object_conf *cconf = lu2cl_conf(conf); int i; @@ -136,9 +136,9 @@ int osc_lvb_print(const struct lu_env *env, void *cookie, static int osc_object_print(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *obj) { - struct osc_object *osc = lu2osc(obj); - struct lov_oinfo *oinfo = osc->oo_oinfo; - struct osc_async_rc *ar = &oinfo->loi_ar; + struct osc_object *osc = lu2osc(obj); + struct lov_oinfo *oinfo = osc->oo_oinfo; + struct osc_async_rc *ar = &oinfo->loi_ar; (*p)(env, cookie, "id: " DOSTID " idx: %d gen: %d kms_valid: %u kms %llu rc: %d force_sync: %d min_xid: %llu ", POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, @@ -163,7 +163,7 @@ int osc_attr_set(const struct lu_env *env, struct cl_object *obj, const struct cl_attr *attr, unsigned valid) { struct lov_oinfo *oinfo = cl2osc(obj)->oo_oinfo; - struct ost_lvb *lvb = &oinfo->loi_lvb; + struct ost_lvb *lvb = &oinfo->loi_lvb; if (valid & CAT_SIZE) lvb->lvb_size = attr->cat_size; @@ -188,7 +188,7 @@ static int osc_object_glimpse(const struct lu_env *env, { struct lov_oinfo *oinfo = cl2osc(obj)->oo_oinfo; - lvb->lvb_size = oinfo->loi_kms; + lvb->lvb_size = oinfo->loi_kms; lvb->lvb_blocks = oinfo->loi_lvb.lvb_blocks; return 0; } @@ -208,9 +208,9 @@ void osc_object_clear_contended(struct osc_object *obj) int osc_object_is_contended(struct osc_object *obj) { - struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev); + struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev); int osc_contention_time = dev->od_contention_time; - unsigned long cur_time = cfs_time_current(); + unsigned long cur_time = cfs_time_current(); unsigned long retry_time; if (OBD_FAIL_CHECK(OBD_FAIL_OSC_OBJECT_CONTENTION)) @@ -255,7 +255,7 @@ struct lu_object *osc_object_alloc(const struct lu_env *env, struct lu_device *dev) { struct osc_object *osc; - struct lu_object *obj; + struct lu_object *obj; OBD_SLAB_ALLOC_PTR_GFP(osc, osc_object_kmem, GFP_NOFS); if (osc != NULL) { diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 76ba58b..43dfa73 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -216,7 +216,7 @@ static int osc_page_cache_add(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *io) { - struct osc_io *oio = osc_env_io(env); + struct osc_io *oio = osc_env_io(env); struct osc_page *opg = cl2osc_page(slice); int result; @@ -247,7 +247,7 @@ void osc_index2policy(ldlm_policy_data_t *policy, const struct cl_object *obj, { memset(policy, 0, sizeof(*policy)); policy->l_extent.start = cl_offset(obj, start); - policy->l_extent.end = cl_offset(obj, end + 1) - 1; + policy->l_extent.end = cl_offset(obj, end + 1) - 1; } static int osc_page_addref_lock(const struct lu_env *env, @@ -255,7 +255,7 @@ static int osc_page_addref_lock(const struct lu_env *env, struct cl_lock *lock) { struct osc_lock *olock; - int rc; + int rc; LASSERT(opg->ops_lock == NULL); @@ -274,7 +274,7 @@ static int osc_page_addref_lock(const struct lu_env *env, static void osc_page_putref_lock(const struct lu_env *env, struct osc_page *opg) { - struct cl_lock *lock = opg->ops_lock; + struct cl_lock *lock = opg->ops_lock; struct osc_lock *olock; LASSERT(lock != NULL); @@ -291,7 +291,7 @@ static int osc_page_is_under_lock(const struct lu_env *env, struct cl_io *unused) { struct cl_lock *lock; - int result = -ENODATA; + int result = -ENODATA; lock = cl_lock_at_page(env, slice->cpl_obj, slice->cpl_page, NULL, 1, 0); @@ -317,7 +317,7 @@ static void osc_page_completion_read(const struct lu_env *env, const struct cl_page_slice *slice, int ioret) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); if (likely(opg->ops_lock)) @@ -329,7 +329,7 @@ static void osc_page_completion_write(const struct lu_env *env, const struct cl_page_slice *slice, int ioret) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(slice->cpl_obj); osc_lru_add(osc_cli(obj), opg); @@ -364,10 +364,10 @@ static int osc_page_print(const struct lu_env *env, const struct cl_page_slice *slice, void *cookie, lu_printer_t printer) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_async_page *oap = &opg->ops_oap; - struct osc_object *obj = cl2osc(slice->cpl_obj); - struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; + struct osc_object *obj = cl2osc(slice->cpl_obj); + struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; return (*printer)(env, cookie, LUSTRE_OSC_NAME "-page@%p: 1< %#x %d %u %s %s > 2< %llu %u %u %#x %#x | %p %p %p > 3< %s %p %d %lu %d > 4< %d %d %d %lu %s | %s %s %s %s > 5< %s %s %s %s | %d %s | %d %s %s>\n", opg, @@ -408,7 +408,7 @@ static int osc_page_print(const struct lu_env *env, static void osc_page_delete(const struct lu_env *env, const struct cl_page_slice *slice) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); int rc; @@ -437,13 +437,13 @@ static void osc_page_delete(const struct lu_env *env, void osc_page_clip(const struct lu_env *env, const struct cl_page_slice *slice, int from, int to) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_async_page *oap = &opg->ops_oap; LINVRNT(osc_page_protected(env, opg, CLM_READ, 0)); opg->ops_from = from; - opg->ops_to = to; + opg->ops_to = to; spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; spin_unlock(&oap->oap_lock); @@ -502,11 +502,11 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, struct page *vmpage) { struct osc_object *osc = cl2osc(obj); - struct osc_page *opg = cl_object_page_slice(obj, page); + struct osc_page *opg = cl_object_page_slice(obj, page); int result; opg->ops_from = 0; - opg->ops_to = PAGE_CACHE_SIZE; + opg->ops_to = PAGE_CACHE_SIZE; result = osc_prep_async_page(osc, opg, vmpage, cl_offset(obj, page->cp_index)); @@ -540,7 +540,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, enum cl_req_type crt, int brw_flags) { struct osc_async_page *oap = &opg->ops_oap; - struct osc_object *obj = oap->oap_obj; + struct osc_object *obj = oap->oap_obj; LINVRNT(osc_page_protected(env, opg, crt == CRT_WRITE ? CLM_WRITE : CLM_READ, 1)); @@ -550,9 +550,9 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, LASSERT(oap->oap_async_flags & ASYNC_READY); LASSERT(oap->oap_async_flags & ASYNC_COUNT_STABLE); - oap->oap_cmd = crt == CRT_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ; - oap->oap_page_off = opg->ops_from; - oap->oap_count = opg->ops_to - opg->ops_from; + oap->oap_cmd = crt == CRT_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ; + oap->oap_page_off = opg->ops_from; + oap->oap_count = opg->ops_to - opg->ops_from; oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags; if (!client_is_remote(osc_export(obj)) && diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c index 6690f14..2ff253f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_quota.c +++ b/drivers/staging/lustre/lustre/osc/osc_quota.c @@ -232,7 +232,7 @@ int osc_quota_setup(struct obd_device *obd) int osc_quota_cleanup(struct obd_device *obd) { - struct client_obd *cli = &obd->u.cli; + struct client_obd *cli = &obd->u.cli; int type; for (type = 0; type < MAXQUOTAS; type++) @@ -245,8 +245,8 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp, struct obd_quotactl *oqctl) { struct ptlrpc_request *req; - struct obd_quotactl *oqc; - int rc; + struct obd_quotactl *oqc; + int rc; req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_OST_QUOTACTL, LUSTRE_OST_VERSION, @@ -285,10 +285,10 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp, int osc_quotacheck(struct obd_device *unused, struct obd_export *exp, struct obd_quotactl *oqctl) { - struct client_obd *cli = &exp->exp_obd->u.cli; - struct ptlrpc_request *req; - struct obd_quotactl *body; - int rc; + struct client_obd *cli = &exp->exp_obd->u.cli; + struct ptlrpc_request *req; + struct obd_quotactl *body; + int rc; req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_OST_QUOTACHECK, LUSTRE_OST_VERSION, diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 6b6851a..c174de9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -264,7 +264,7 @@ static int osc_getattr_async(struct obd_export *exp, struct obd_info *oinfo, { struct ptlrpc_request *req; struct osc_async_args *aa; - int rc; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR); if (req == NULL) @@ -294,8 +294,8 @@ static int osc_getattr(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo) { struct ptlrpc_request *req; - struct ost_body *body; - int rc; + struct ost_body *body; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR); if (req == NULL) @@ -338,8 +338,8 @@ static int osc_setattr(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti) { struct ptlrpc_request *req; - struct ost_body *body; - int rc; + struct ost_body *body; + int rc; LASSERT(oinfo->oi_oa->o_valid & OBD_MD_FLGROUP); @@ -403,9 +403,9 @@ int osc_setattr_async_base(struct obd_export *exp, struct obd_info *oinfo, obd_enqueue_update_f upcall, void *cookie, struct ptlrpc_request_set *rqset) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct osc_setattr_args *sa; - int rc; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR); if (req == NULL) @@ -460,9 +460,9 @@ int osc_real_create(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti) { struct ptlrpc_request *req; - struct ost_body *body; - struct lov_stripe_md *lsm; - int rc; + struct ost_body *body; + struct lov_stripe_md *lsm; + int rc; LASSERT(oa); LASSERT(ea); @@ -548,10 +548,10 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo, obd_enqueue_update_f upcall, void *cookie, struct ptlrpc_request_set *rqset) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct osc_setattr_args *sa; - struct ost_body *body; - int rc; + struct ost_body *body; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_PUNCH); if (req == NULL) @@ -577,7 +577,7 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo, req->rq_interpret_reply = (ptlrpc_interpterer_t)osc_setattr_interpret; CLASSERT (sizeof(*sa) <= sizeof(req->rq_async_args)); sa = ptlrpc_req_async_args(req); - sa->sa_oa = oinfo->oi_oa; + sa->sa_oa = oinfo->oi_oa; sa->sa_upcall = upcall; sa->sa_cookie = cookie; if (rqset == PTLRPCD_SET) @@ -616,9 +616,9 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo, struct ptlrpc_request_set *rqset) { struct ptlrpc_request *req; - struct ost_body *body; + struct ost_body *body; struct osc_fsync_args *fa; - int rc; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SYNC); if (req == NULL) @@ -757,9 +757,9 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, struct obd_trans_info *oti, struct obd_export *md_export, void *capa) { - struct client_obd *cli = &exp->exp_obd->u.cli; + struct client_obd *cli = &exp->exp_obd->u.cli; struct ptlrpc_request *req; - struct ost_body *body; + struct ost_body *body; LIST_HEAD(cancels); int rc, count; @@ -947,7 +947,7 @@ static int osc_shrink_grant(struct client_obd *cli) int osc_shrink_grant_to_target(struct client_obd *cli, __u64 target_bytes) { - int rc = 0; + int rc = 0; struct ost_body *body; client_obd_list_lock(&cli->cl_loi_list_lock); @@ -1131,8 +1131,8 @@ static int check_write_rcs(struct ptlrpc_request *req, int requested_nob, int niocount, u32 page_count, struct brw_page **pga) { - int i; - __u32 *remote_rcs; + int i; + __u32 *remote_rcs; remote_rcs = req_capsule_server_sized_get(&req->rq_pill, &RMF_RCS, sizeof(*remote_rcs) * @@ -1182,15 +1182,15 @@ static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2) } static u32 osc_checksum_bulk(int nob, u32 pg_count, - struct brw_page **pga, int opc, - cksum_type_t cksum_type) + struct brw_page **pga, int opc, + cksum_type_t cksum_type) { - __u32 cksum; - int i = 0; - struct cfs_crypto_hash_desc *hdesc; - unsigned int bufsize; - int err; - unsigned char cfs_alg = cksum_obd2cfs(cksum_type); + __u32 cksum; + int i = 0; + struct cfs_crypto_hash_desc *hdesc; + unsigned int bufsize; + int err; + unsigned char cfs_alg = cksum_obd2cfs(cksum_type); LASSERT(pg_count > 0); @@ -1250,14 +1250,14 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, struct obd_capa *ocapa, int reserve, int resend) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct ptlrpc_bulk_desc *desc; - struct ost_body *body; - struct obd_ioobj *ioobj; - struct niobuf_remote *niobuf; + struct ost_body *body; + struct obd_ioobj *ioobj; + struct niobuf_remote *niobuf; int niocount, i, requested_nob, opc, rc; struct osc_brw_async_args *aa; - struct req_capsule *pill; + struct req_capsule *pill; struct brw_page *pg_prev; if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ)) @@ -1359,8 +1359,8 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, niobuf->len += pg->count; } else { niobuf->offset = pg->off; - niobuf->len = pg->count; - niobuf->flags = pg->flag; + niobuf->len = pg->count; + niobuf->flags = pg->flag; } pg_prev = pg; } @@ -1581,9 +1581,9 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) if (body->oa.o_valid & OBD_MD_FLCKSUM) { static int cksum_counter; - __u32 server_cksum = body->oa.o_cksum; - char *via; - char *router; + __u32 server_cksum = body->oa.o_cksum; + char *via; + char *router; cksum_type_t cksum_type; cksum_type = cksum_type_unpack(body->oa.o_valid &OBD_MD_FLFLAGS? @@ -1758,7 +1758,7 @@ static int brw_interpret(const struct lu_env *env, struct osc_brw_async_args *aa = data; struct osc_extent *ext; struct osc_extent *tmp; - struct cl_object *obj = NULL; + struct cl_object *obj = NULL; struct client_obd *cli = aa->aa_cli; rc = osc_brw_fini_request(req, rc); @@ -1862,26 +1862,25 @@ static int brw_interpret(const struct lu_env *env, int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, struct list_head *ext_list, int cmd, pdl_policy_t pol) { - struct ptlrpc_request *req = NULL; - struct osc_extent *ext; - struct brw_page **pga = NULL; - struct osc_brw_async_args *aa = NULL; - struct obdo *oa = NULL; - struct osc_async_page *oap; - struct osc_async_page *tmp; - struct cl_req *clerq = NULL; - enum cl_req_type crt = (cmd & OBD_BRW_WRITE) ? CRT_WRITE : - CRT_READ; - struct ldlm_lock *lock = NULL; - struct cl_req_attr *crattr = NULL; - u64 starting_offset = OBD_OBJECT_EOF; - u64 ending_offset = 0; - int mpflag = 0; - int mem_tight = 0; - int page_count = 0; - int i; - int rc; - struct ost_body *body; + struct ptlrpc_request *req = NULL; + struct osc_extent *ext; + struct brw_page **pga = NULL; + struct osc_brw_async_args *aa = NULL; + struct obdo *oa = NULL; + struct osc_async_page *oap; + struct osc_async_page *tmp; + struct cl_req *clerq = NULL; + enum cl_req_type crt = (cmd & OBD_BRW_WRITE) ? CRT_WRITE : CRT_READ; + struct ldlm_lock *lock = NULL; + struct cl_req_attr *crattr = NULL; + u64 starting_offset = OBD_OBJECT_EOF; + u64 ending_offset = 0; + int mpflag = 0; + int mem_tight = 0; + int page_count = 0; + int i; + int rc; + struct ost_body *body; LIST_HEAD(rpc_list); LASSERT(!list_empty(ext_list)); @@ -2480,10 +2479,10 @@ static int osc_statfs_async(struct obd_export *exp, struct obd_info *oinfo, __u64 max_age, struct ptlrpc_request_set *rqset) { - struct obd_device *obd = class_exp2obd(exp); + struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; struct osc_async_args *aa; - int rc; + int rc; /* We could possibly pass max_age in the request (as an absolute * timestamp or a "seconds.usec ago") so the target can avoid doing @@ -2522,10 +2521,10 @@ static int osc_statfs_async(struct obd_export *exp, static int osc_statfs(const struct lu_env *env, struct obd_export *exp, struct obd_statfs *osfs, __u64 max_age, __u32 flags) { - struct obd_device *obd = class_exp2obd(exp); - struct obd_statfs *msfs; + struct obd_device *obd = class_exp2obd(exp); + struct obd_statfs *msfs; struct ptlrpc_request *req; - struct obd_import *imp = NULL; + struct obd_import *imp = NULL; int rc; /*Since the request might also come from lprocfs, so we need @@ -2749,9 +2748,9 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp, return 0; } else if (KEY_IS(KEY_LAST_ID)) { struct ptlrpc_request *req; - u64 *reply; - char *tmp; - int rc; + u64 *reply; + char *tmp; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GET_INFO_LAST_ID); @@ -2788,14 +2787,14 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp, } else if (KEY_IS(KEY_FIEMAP)) { struct ll_fiemap_info_key *fm_key = (struct ll_fiemap_info_key *)key; - struct ldlm_res_id res_id; - ldlm_policy_data_t policy; - struct lustre_handle lockh; - ldlm_mode_t mode = 0; - struct ptlrpc_request *req; - struct ll_user_fiemap *reply; - char *tmp; - int rc; + struct ldlm_res_id res_id; + ldlm_policy_data_t policy; + struct lustre_handle lockh; + ldlm_mode_t mode = 0; + struct ptlrpc_request *req; + struct ll_user_fiemap *reply; + char *tmp; + int rc; if (!(fm_key->fiemap.fm_flags & FIEMAP_FLAG_SYNC)) goto skip_locking; @@ -2881,10 +2880,10 @@ static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp, void *val, struct ptlrpc_request_set *set) { struct ptlrpc_request *req; - struct obd_device *obd = exp->exp_obd; - struct obd_import *imp = class_exp2cliimp(exp); - char *tmp; - int rc; + struct obd_device *obd = exp->exp_obd; + struct obd_import *imp = class_exp2cliimp(exp); + char *tmp; + int rc; OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_SHUTDOWN, 10); @@ -3071,8 +3070,8 @@ static int osc_import_event(struct obd_device *obd, } case IMP_EVENT_INVALIDATE: { struct ldlm_namespace *ns = obd->obd_namespace; - struct lu_env *env; - int refcheck; + struct lu_env *env; + int refcheck; env = cl_env_get(&refcheck); if (!IS_ERR(env)) { @@ -3159,9 +3158,9 @@ static int brw_queue_work(const struct lu_env *env, void *data) int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { struct lprocfs_static_vars lvars = { NULL }; - struct client_obd *cli = &obd->u.cli; - void *handler; - int rc; + struct client_obd *cli = &obd->u.cli; + void *handler; + int rc; rc = ptlrpcd_addref(); if (rc) -- 1.7.1 From simmonsja at ornl.gov Tue Jun 2 17:29:13 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Tue, 2 Jun 2015 17:29:13 +0000 Subject: [lustre-devel] [HPDD-discuss] [PATCH v1] staging: lustre: libcfs: add __user annotation in libcfs_ioctl_data In-Reply-To: <20150602013115.GB23940@kroah.com> References: <1432615204-4062-1-git-send-email-ddecotig@gmail.com> <20150531022744.GA31012@kroah.com> <20150602013115.GB23940@kroah.com> Message-ID: <6de5257ecd664c898c9108490e989a88@EXCHCS34.ornl.gov> >>On Mon, Jun 01, 2015 at 12:21:30PM -0700, David Decotigny wrote: >> Thanks for reviewing. >> >> The 2 struct members were not marked as __user, which this patch does >> here. This was causing warnings with copy from/to user (see commit >> description). This patch also propagates the annotation to the couple >> of functions that are using those members. > >Lustre's structures are a total mess of kernel and user pointers and >trying to properly mark them as which they are supposed to be at what >point in time is a very difficult task. People keep trying and get it >wrong, so I suggest just leaving this alone until the developers unwind >the structure mess as that will be necessary for this code to get merged >into the main part of the kernel. Greg is right. The earlier patch set I sent out for the LNet headers address this issue for the LNet layer. I also having patches coming that fix libcfs ioctl handling as well. I see Shuey's patches made it in first so I'm going to have to rebase. I will send out the new patch sets later today. This will be v3 of the patch set. From sudipm.mukherjee at gmail.com Wed Jun 3 05:54:25 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Wed, 3 Jun 2015 11:24:25 +0530 Subject: [lustre-devel] [PATCH resend] staging: lustre: osc: clean up whitespace and align function parameters In-Reply-To: <1433259139-11202-1-git-send-email-hannac@iu.edu> References: <1433259139-11202-1-git-send-email-hannac@iu.edu> Message-ID: <20150603055425.GB4936@sudip-PC> On Tue, Jun 02, 2015 at 11:32:19AM -0400, Chris Hanna wrote: > Signed-off-by: Chris Hanna > > Minor changes to remove excessive whitespace and improve > readability of functions. this description should come above your Signed-off-by line. regards sudip From alexander.zarochentsev at seagate.com Wed Jun 3 07:44:59 2015 From: alexander.zarochentsev at seagate.com (Alexander Zarochentsev) Date: Wed, 3 Jun 2015 10:44:59 +0300 Subject: [lustre-devel] how to fix unfair cpu_parttions load distribution? Message-ID: Hello, FPP IOR tests with 8-16 clients show difference in write speed between clients: for example result files after 60 sec stonewalling write test: -rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000000.0 -rw-r--r-- 1 root root 22G Apr 22 15:03 out.00000001.0 -rw-r--r-- 1 root root 6.4G Apr 22 15:03 out.00000002.0 -rw-r--r-- 1 root root 9.8G Apr 22 15:03 out.00000003.0 -rw-r--r-- 1 root root 6.5G Apr 22 15:03 out.00000004.0 -rw-r--r-- 1 root root 6.7G Apr 22 15:03 out.00000005.0 -rw-r--r-- 1 root root 9.9G Apr 22 15:03 out.00000006.0 -rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000007.0 -rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000008.0 -rw-r--r-- 1 root root 21G Apr 22 15:03 out.00000009.0 -rw-r--r-- 1 root root 6.8G Apr 22 15:03 out.00000010.0 -rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000011.0 -rw-r--r-- 1 root root 6.7G Apr 22 15:03 out.00000012.0 -rw-r--r-- 1 root root 6.6G Apr 22 15:03 out.00000013.0 -rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000014.0 -rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000015.0 the fastest client was able to write 22GB and the slowest one only 6.7GB. The funny thing that file size distribution depends on clients and sometimes (rare) all clients write at the same speed. LNET provides a mapping between client NIDs and CPU partitions calculated as a hash of 64bit NID. The mapping is often not fair for small number of clients and I guess may be not so good for larger client pool too (depends on how client nids are assigned). Unfair mapping causes uneven load on cpu partitions and that different client speed. Disabling cpu partitions in libcfs restores equal client write speed with some cost of performance. Currently there is no mechanism to balance load between CPs. NRS might be a solution but it is not, it works on each CP individually (correct?). At least no effects from non-default NRS policies were observed. I think better load distribution may gave some performance gain. Also NRS does not work as expected with CPs. Replacing NID->CP mapping by RR looks not easy. Any ideas how it the load distribution can be improved ? Thanks, -- Alexander Zarochentsev Seagate Technology, LLC www.seagate.com From liang.zhen at intel.com Wed Jun 3 13:11:26 2015 From: liang.zhen at intel.com (Zhen, Liang) Date: Wed, 3 Jun 2015 13:11:26 +0000 Subject: [lustre-devel] how to fix unfair cpu_parttions load distribution? In-Reply-To: References: Message-ID: Hi, one thing you may want to try is, turn on portal rotor by this way: Echo 1 > /proc/sys/lnet/portal_rotor This will round-robin dispatch incoming requests to IO services in different partitions, the drawback of this approach is, incoming request will lose NUMA affinity, so I suspect you will lose a little performance. Another way to improve this is, create multiple lnet networks and evenly distribute clients to different networks, and explicitly bind network on CPU partition (see lustre manual for details). Regards Liang On 6/3/15, 3:44 PM, "Alexander Zarochentsev" wrote: >Hello, > >FPP IOR tests with 8-16 clients show difference in write speed between >clients: >for example result files after 60 sec stonewalling write test: > >-rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000000.0 >-rw-r--r-- 1 root root 22G Apr 22 15:03 out.00000001.0 >-rw-r--r-- 1 root root 6.4G Apr 22 15:03 out.00000002.0 >-rw-r--r-- 1 root root 9.8G Apr 22 15:03 out.00000003.0 >-rw-r--r-- 1 root root 6.5G Apr 22 15:03 out.00000004.0 >-rw-r--r-- 1 root root 6.7G Apr 22 15:03 out.00000005.0 >-rw-r--r-- 1 root root 9.9G Apr 22 15:03 out.00000006.0 >-rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000007.0 >-rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000008.0 >-rw-r--r-- 1 root root 21G Apr 22 15:03 out.00000009.0 >-rw-r--r-- 1 root root 6.8G Apr 22 15:03 out.00000010.0 >-rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000011.0 >-rw-r--r-- 1 root root 6.7G Apr 22 15:03 out.00000012.0 >-rw-r--r-- 1 root root 6.6G Apr 22 15:03 out.00000013.0 >-rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000014.0 >-rw-r--r-- 1 root root 11G Apr 22 15:03 out.00000015.0 > >the fastest client was able to write 22GB and the slowest one only 6.7GB. > >The funny thing that file size distribution depends on clients and >sometimes (rare) all clients write at the same speed. > >LNET provides a mapping between client NIDs and CPU partitions >calculated as a hash of 64bit NID. The mapping is often not fair for >small number of clients and I guess may be not so good for larger >client pool too (depends on how client nids are assigned). > >Unfair mapping causes uneven load on cpu partitions and that different >client speed. Disabling cpu partitions in libcfs restores equal client >write speed with some cost of performance. > >Currently there is no mechanism to balance load between CPs. NRS might >be a solution but it is not, it works on each CP individually >(correct?). At least no effects from non-default NRS policies were >observed. > >I think better load distribution may gave some performance gain. Also >NRS does not work as expected with CPs. > >Replacing NID->CP mapping by RR looks not easy. Any ideas how it the >load distribution can be improved ? > >Thanks, >-- >Alexander Zarochentsev >Seagate Technology, LLC >www.seagate.com From hannac at iu.edu Wed Jun 3 14:21:22 2015 From: hannac at iu.edu (Chris Hanna) Date: Wed, 03 Jun 2015 10:21:22 -0400 Subject: [lustre-devel] [PATCH resend] staging: lustre: osc: clean up whitespace and align function parameters In-Reply-To: <20150603055425.GB4936@sudip-PC> References: <1433259139-11202-1-git-send-email-hannac@iu.edu> <20150603055425.GB4936@sudip-PC> Message-ID: <556F0D62.2060300@iu.edu> Thanks for noticing, I'll re-submit correctly. Chris On 6/3/15 1:54 AM, Sudip Mukherjee wrote: > On Tue, Jun 02, 2015 at 11:32:19AM -0400, Chris Hanna wrote: >> Signed-off-by: Chris Hanna >> >> Minor changes to remove excessive whitespace and improve >> readability of functions. > this description should come above your Signed-off-by line. > > regards > sudip From hannac at iu.edu Wed Jun 3 14:23:42 2015 From: hannac at iu.edu (Chris Hanna) Date: Wed, 3 Jun 2015 10:23:42 -0400 Subject: [lustre-devel] [PATCH resend] staging: lustre: osc: clean up whitespace and align function parameters Message-ID: <1433341422-7998-1-git-send-email-hannac@iu.edu> Minor changes to remove excessive whitespace and improve readability of osc functions. Signed-off-by: Chris Hanna --- Sending again due to tree mismatch. drivers/staging/lustre/lustre/osc/lproc_osc.c | 18 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 196 +++++++++++----------- drivers/staging/lustre/lustre/osc/osc_dev.c | 12 +- drivers/staging/lustre/lustre/osc/osc_io.c | 124 +++++++------- drivers/staging/lustre/lustre/osc/osc_lock.c | 148 +++++++++--------- drivers/staging/lustre/lustre/osc/osc_object.c | 18 +- drivers/staging/lustre/lustre/osc/osc_page.c | 38 +++--- drivers/staging/lustre/lustre/osc/osc_quota.c | 14 +- drivers/staging/lustre/lustre/osc/osc_request.c | 169 ++++++++++---------- 9 files changed, 368 insertions(+), 369 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 9dc84ba..ff6d2e2 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -417,8 +417,8 @@ static ssize_t osc_checksum_type_seq_write(struct file *file, LPROC_SEQ_FOPS(osc_checksum_type); static ssize_t resend_count_show(struct kobject *kobj, - struct attribute *attr, - char *buf) + struct attribute *attr, + char *buf) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kobj); @@ -427,9 +427,9 @@ static ssize_t resend_count_show(struct kobject *kobj, } static ssize_t resend_count_store(struct kobject *kobj, - struct attribute *attr, - const char *buffer, - size_t count) + struct attribute *attr, + const char *buffer, + size_t count) { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kobj); @@ -682,8 +682,8 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) #undef pct static ssize_t osc_rpc_stats_seq_write(struct file *file, - const char __user *buf, - size_t len, loff_t *off) + const char __user *buf, + size_t len, loff_t *off) { struct seq_file *seq = file->private_data; struct obd_device *dev = seq->private; @@ -721,8 +721,8 @@ static int osc_stats_seq_show(struct seq_file *seq, void *v) } static ssize_t osc_stats_seq_write(struct file *file, - const char __user *buf, - size_t len, loff_t *off) + const char __user *buf, + size_t len, loff_t *off) { struct seq_file *seq = file->private_data; struct obd_device *dev = seq->private; diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index d44b3d4..5592d32 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -112,8 +112,8 @@ static const char *oes_strings[] = { /* ----- extent part 0 ----- */ \ __ext, EXTPARA(__ext), \ /* ----- part 1 ----- */ \ - atomic_read(&__ext->oe_refc), \ - atomic_read(&__ext->oe_users), \ + atomic_read(&__ext->oe_refc), \ + atomic_read(&__ext->oe_users), \ list_empty_marker(&__ext->oe_link), \ oes_strings[__ext->oe_state], ext_flags(__ext, __buf), \ __ext->oe_obj, \ @@ -297,12 +297,12 @@ out: #define sanity_check_nolock(ext) \ osc_extent_sanity_check0(ext, __func__, __LINE__) -#define sanity_check(ext) ({ \ - int __res; \ +#define sanity_check(ext) ({ \ + int __res; \ osc_object_lock((ext)->oe_obj); \ - __res = sanity_check_nolock(ext); \ - osc_object_unlock((ext)->oe_obj); \ - __res; \ + __res = sanity_check_nolock(ext); \ + osc_object_unlock((ext)->oe_obj); \ + __res; \ }) @@ -411,7 +411,7 @@ static void osc_extent_put_trust(struct osc_extent *ext) static struct osc_extent *osc_extent_search(struct osc_object *obj, pgoff_t index) { - struct rb_node *n = obj->oo_root.rb_node; + struct rb_node *n = obj->oo_root.rb_node; struct osc_extent *tmp, *p = NULL; LASSERT(osc_object_is_locked(obj)); @@ -447,8 +447,8 @@ static struct osc_extent *osc_extent_lookup(struct osc_object *obj, /* caller must have held object lock. */ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) { - struct rb_node **n = &obj->oo_root.rb_node; - struct rb_node *parent = NULL; + struct rb_node **n = &obj->oo_root.rb_node; + struct rb_node *parent = NULL; struct osc_extent *tmp; LASSERT(ext->oe_intree == 0); @@ -544,19 +544,19 @@ static int osc_extent_merge(const struct lu_env *env, struct osc_extent *cur, LASSERT(cur->oe_osclock == victim->oe_osclock); ppc_bits = osc_cli(obj)->cl_chunkbits - PAGE_CACHE_SHIFT; chunk_start = cur->oe_start >> ppc_bits; - chunk_end = cur->oe_end >> ppc_bits; - if (chunk_start != (victim->oe_end >> ppc_bits) + 1 && + chunk_end = cur->oe_end >> ppc_bits; + if (chunk_start != (victim->oe_end >> ppc_bits) + 1 && chunk_end + 1 != victim->oe_start >> ppc_bits) return -ERANGE; OSC_EXTENT_DUMP(D_CACHE, victim, "will be merged by %p.\n", cur); - cur->oe_start = min(cur->oe_start, victim->oe_start); - cur->oe_end = max(cur->oe_end, victim->oe_end); - cur->oe_grants += victim->oe_grants; + cur->oe_start = min(cur->oe_start, victim->oe_start); + cur->oe_end = max(cur->oe_end, victim->oe_end); + cur->oe_grants += victim->oe_grants; cur->oe_nr_pages += victim->oe_nr_pages; /* only the following bits are needed to merge */ - cur->oe_urgent |= victim->oe_urgent; + cur->oe_urgent |= victim->oe_urgent; cur->oe_memalloc |= victim->oe_memalloc; list_splice_init(&victim->oe_pages, &cur->oe_pages); list_del_init(&victim->oe_link); @@ -624,18 +624,18 @@ struct osc_extent *osc_extent_find(const struct lu_env *env, { struct client_obd *cli = osc_cli(obj); - struct cl_lock *lock; + struct cl_lock *lock; struct osc_extent *cur; struct osc_extent *ext; struct osc_extent *conflict = NULL; struct osc_extent *found = NULL; - pgoff_t chunk; - pgoff_t max_end; - int max_pages; /* max_pages_per_rpc */ - int chunksize; - int ppc_bits; /* pages per chunk bits */ - int chunk_mask; - int rc; + pgoff_t chunk; + pgoff_t max_end; + int max_pages; /* max_pages_per_rpc */ + int chunksize; + int ppc_bits; /* pages per chunk bits */ + int chunk_mask; + int rc; cur = osc_extent_alloc(obj); if (cur == NULL) @@ -646,10 +646,10 @@ struct osc_extent *osc_extent_find(const struct lu_env *env, LASSERT(lock->cll_descr.cld_mode >= CLM_WRITE); LASSERT(cli->cl_chunkbits >= PAGE_CACHE_SHIFT); - ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; + ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; chunk_mask = ~((1 << ppc_bits) - 1); - chunksize = 1 << cli->cl_chunkbits; - chunk = index >> ppc_bits; + chunksize = 1 << cli->cl_chunkbits; + chunk = index >> ppc_bits; /* align end to rpc edge, rpc size may not be a power 2 integer. */ max_pages = cli->cl_max_pages_per_rpc; @@ -659,15 +659,15 @@ struct osc_extent *osc_extent_find(const struct lu_env *env, /* initialize new extent by parameters so far */ cur->oe_max_end = max_end; - cur->oe_start = index & chunk_mask; - cur->oe_end = ((index + ~chunk_mask + 1) & chunk_mask) - 1; + cur->oe_start = index & chunk_mask; + cur->oe_end = ((index + ~chunk_mask + 1) & chunk_mask) - 1; if (cur->oe_start < lock->cll_descr.cld_start) cur->oe_start = lock->cll_descr.cld_start; if (cur->oe_end > max_end) cur->oe_end = max_end; cur->oe_osclock = lock; - cur->oe_grants = 0; - cur->oe_mppr = max_pages; + cur->oe_grants = 0; + cur->oe_mppr = max_pages; /* grants has been allocated by caller */ LASSERTF(*grants >= chunksize + cli->cl_extent_tax, @@ -681,7 +681,7 @@ restart: ext = first_extent(obj); while (ext != NULL) { loff_t ext_chk_start = ext->oe_start >> ppc_bits; - loff_t ext_chk_end = ext->oe_end >> ppc_bits; + loff_t ext_chk_end = ext->oe_end >> ppc_bits; LASSERT(sanity_check_nolock(ext) == 0); if (chunk > ext_chk_end + 1) @@ -755,14 +755,14 @@ restart: EASSERT((ext->oe_start & ~chunk_mask) == 0, ext); /* pull ext's start back to cover cur */ - ext->oe_start = cur->oe_start; + ext->oe_start = cur->oe_start; ext->oe_grants += chunksize; *grants -= chunksize; found = osc_extent_hold(ext); } else if (chunk == ext_chk_end + 1) { /* rear merge */ - ext->oe_end = cur->oe_end; + ext->oe_end = cur->oe_end; ext->oe_grants += chunksize; *grants -= chunksize; @@ -943,21 +943,21 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, * @size, then partial truncate happens. */ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, - bool partial) + bool partial) { - struct cl_env_nest nest; - struct lu_env *env; - struct cl_io *io; - struct osc_object *obj = ext->oe_obj; - struct client_obd *cli = osc_cli(obj); + struct cl_env_nest nest; + struct lu_env *env; + struct cl_io *io; + struct osc_object *obj = ext->oe_obj; + struct client_obd *cli = osc_cli(obj); struct osc_async_page *oap; struct osc_async_page *tmp; - int pages_in_chunk = 0; - int ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; - __u64 trunc_chunk = trunc_index >> ppc_bits; - int grants = 0; - int nr_pages = 0; - int rc = 0; + int pages_in_chunk = 0; + int ppc_bits = cli->cl_chunkbits - PAGE_CACHE_SHIFT; + __u64 trunc_chunk = trunc_index >> ppc_bits; + int grants = 0; + int nr_pages = 0; + int rc = 0; LASSERT(sanity_check(ext) == 0); EASSERT(ext->oe_state == OES_TRUNC, ext); @@ -976,8 +976,8 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, /* discard all pages with index greater then trunc_index */ list_for_each_entry_safe(oap, tmp, &ext->oe_pages, oap_pending_item) { - struct cl_page *sub = oap2cl_page(oap); - struct cl_page *page = cl_page_top(sub); + struct cl_page *sub = oap2cl_page(oap); + struct cl_page *page = cl_page_top(sub); LASSERT(list_empty(&oap->oap_rpc_item)); @@ -1022,7 +1022,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, grants = ext->oe_grants; ext->oe_grants = 0; } else { /* calculate how many grants we can free */ - int chunks = (ext->oe_end >> ppc_bits) - trunc_chunk; + int chunks = (ext->oe_end >> ppc_bits) - trunc_chunk; pgoff_t last_index; @@ -1038,10 +1038,10 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, } /* this is what we can free from this extent */ - grants = chunks << cli->cl_chunkbits; + grants = chunks << cli->cl_chunkbits; ext->oe_grants -= grants; - last_index = ((trunc_chunk + 1) << ppc_bits) - 1; - ext->oe_end = min(last_index, ext->oe_max_end); + last_index = ((trunc_chunk + 1) << ppc_bits) - 1; + ext->oe_end = min(last_index, ext->oe_max_end); LASSERT(ext->oe_end >= ext->oe_start); LASSERT(ext->oe_grants > 0); } @@ -1236,8 +1236,8 @@ static inline int osc_is_ready(struct osc_object *osc) static int osc_make_ready(const struct lu_env *env, struct osc_async_page *oap, int cmd) { - struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = cl_page_top(oap2cl_page(oap)); + struct osc_page *opg = oap2osc_page(oap); + struct cl_page *page = cl_page_top(oap2cl_page(oap)); int result; LASSERT(cmd == OBD_BRW_WRITE); /* no cached reads */ @@ -1251,10 +1251,10 @@ static int osc_make_ready(const struct lu_env *env, struct osc_async_page *oap, static int osc_refresh_count(const struct lu_env *env, struct osc_async_page *oap, int cmd) { - struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = oap2cl_page(oap); + struct osc_page *opg = oap2osc_page(oap); + struct cl_page *page = oap2cl_page(oap); struct cl_object *obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int result; loff_t kms; @@ -1283,10 +1283,10 @@ static int osc_refresh_count(const struct lu_env *env, static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, int cmd, int rc) { - struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = cl_page_top(oap2cl_page(oap)); - struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); - enum cl_req_type crt; + struct osc_page *opg = oap2osc_page(oap); + struct cl_page *page = cl_page_top(oap2cl_page(oap)); + struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); + enum cl_req_type crt; int srvlock; cmd &= ~OBD_BRW_NOQUOTA; @@ -1318,7 +1318,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, /* statistic */ if (rc == 0 && srvlock) { - struct lu_device *ld = opg->ops_cl.cpl_obj->co_lu.lo_dev; + struct lu_device *ld = opg->ops_cl.cpl_obj->co_lu.lo_dev; struct osc_stats *stats = &lu2osc_dev(ld)->od_stats; int bytes = oap->oap_count; @@ -1396,7 +1396,7 @@ static int osc_reserve_grant(struct client_obd *cli, unsigned int bytes) int rc = -EDQUOT; if (cli->cl_avail_grant >= bytes) { - cli->cl_avail_grant -= bytes; + cli->cl_avail_grant -= bytes; cli->cl_reserved_grant += bytes; rc = 0; } @@ -1527,7 +1527,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, struct osc_async_page *oap, int bytes) { struct osc_object *osc = oap->oap_obj; - struct lov_oinfo *loi = osc->oo_oinfo; + struct lov_oinfo *loi = osc->oo_oinfo; struct osc_cache_waiter ocw; struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); int rc = -EDQUOT; @@ -1782,7 +1782,7 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, struct osc_async_page *oap, int sent, int rc) { struct osc_object *osc = oap->oap_obj; - struct lov_oinfo *loi = osc->oo_oinfo; + struct lov_oinfo *loi = osc->oo_oinfo; __u64 xid = 0; if (oap->oap_request != NULL) { @@ -2049,7 +2049,7 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, #define list_to_obj(list, item) ({ \ struct list_head *__tmp = (list)->next; \ - list_del_init(__tmp); \ + list_del_init(__tmp); \ list_entry(__tmp, struct osc_object, oo_##item); \ }) @@ -2179,7 +2179,7 @@ static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, } static int osc_io_unplug_async(const struct lu_env *env, - struct client_obd *cli, struct osc_object *osc) + struct client_obd *cli, struct osc_object *osc) { /* XXX: policy is no use actually. */ return osc_io_unplug0(env, cli, osc, PDL_POLICY_ROUND, 1); @@ -2194,7 +2194,7 @@ void osc_io_unplug(const struct lu_env *env, struct client_obd *cli, int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, struct page *page, loff_t offset) { - struct obd_export *exp = osc_export(osc); + struct obd_export *exp = osc_export(osc); struct osc_async_page *oap = &ops->ops_oap; if (!page) @@ -2224,16 +2224,16 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, struct osc_page *ops) { struct osc_io *oio = osc_env_io(env); - struct osc_extent *ext = NULL; + struct osc_extent *ext = NULL; struct osc_async_page *oap = &ops->ops_oap; - struct client_obd *cli = oap->oap_cli; - struct osc_object *osc = oap->oap_obj; + struct client_obd *cli = oap->oap_cli; + struct osc_object *osc = oap->oap_obj; pgoff_t index; - int grants = 0; - int brw_flags = OBD_BRW_ASYNC; - int cmd = OBD_BRW_WRITE; - int need_release = 0; - int rc = 0; + int grants = 0; + int brw_flags = OBD_BRW_ASYNC; + int cmd = OBD_BRW_WRITE; + int need_release = 0; + int rc = 0; if (oap->oap_magic != OAP_MAGIC) return -EINVAL; @@ -2256,7 +2256,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, /* check if the file's owner/group is over quota */ if (!(cmd & OBD_BRW_NOQUOTA)) { struct cl_object *obj; - struct cl_attr *attr; + struct cl_attr *attr; unsigned int qid[MAXQUOTAS]; obj = cl_object_top(&osc->oo_cl); @@ -2386,7 +2386,7 @@ int osc_teardown_async_page(const struct lu_env *env, struct osc_object *obj, struct osc_page *ops) { struct osc_async_page *oap = &ops->ops_oap; - struct osc_extent *ext = NULL; + struct osc_extent *ext = NULL; int rc = 0; LASSERT(oap->oap_magic == OAP_MAGIC); @@ -2425,10 +2425,10 @@ int osc_teardown_async_page(const struct lu_env *env, int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, struct osc_page *ops) { - struct osc_extent *ext = NULL; - struct osc_object *obj = cl2osc(ops->ops_cl.cpl_obj); - struct cl_page *cp = ops->ops_cl.cpl_page; - pgoff_t index = cp->cp_index; + struct osc_extent *ext = NULL; + struct osc_object *obj = cl2osc(ops->ops_cl.cpl_obj); + struct cl_page *cp = ops->ops_cl.cpl_page; + pgoff_t index = cp->cp_index; struct osc_async_page *oap = &ops->ops_oap; bool unplug = false; int rc = 0; @@ -2507,14 +2507,14 @@ out: int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) { struct osc_async_page *oap = &ops->ops_oap; - struct osc_object *obj = oap->oap_obj; - struct client_obd *cli = osc_cli(obj); - struct osc_extent *ext; - struct osc_extent *found = NULL; - struct list_head *plist; + struct osc_object *obj = oap->oap_obj; + struct client_obd *cli = osc_cli(obj); + struct osc_extent *ext; + struct osc_extent *found = NULL; + struct list_head *plist; pgoff_t index = oap2cl_page(oap)->cp_index; - int rc = -EBUSY; - int cmd; + int rc = -EBUSY; + int cmd; LASSERT(!oap->oap_interrupted); oap->oap_interrupted = 1; @@ -2523,10 +2523,10 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) osc_object_lock(obj); if (oap->oap_cmd & OBD_BRW_WRITE) { plist = &obj->oo_urgent_exts; - cmd = OBD_BRW_WRITE; + cmd = OBD_BRW_WRITE; } else { plist = &obj->oo_reading_exts; - cmd = OBD_BRW_READ; + cmd = OBD_BRW_READ; } list_for_each_entry(ext, plist, oe_link) { if (ext->oe_start <= index && ext->oe_end >= index) { @@ -2564,13 +2564,13 @@ int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, struct list_head *list, int cmd, int brw_flags) { - struct client_obd *cli = osc_cli(obj); - struct osc_extent *ext; + struct client_obd *cli = osc_cli(obj); + struct osc_extent *ext; struct osc_async_page *oap, *tmp; - int page_count = 0; - int mppr = cli->cl_max_pages_per_rpc; - pgoff_t start = CL_PAGE_EOF; - pgoff_t end = 0; + int page_count = 0; + int mppr = cli->cl_max_pages_per_rpc; + pgoff_t start = CL_PAGE_EOF; + pgoff_t end = 0; list_for_each_entry(oap, list, oap_pending_item) { struct cl_page *cp = oap2cl_page(oap); @@ -2785,7 +2785,7 @@ int osc_cache_wait_range(const struct lu_env *env, struct osc_object *obj, { struct osc_extent *ext; pgoff_t index = start; - int result = 0; + int result = 0; again: osc_object_lock(obj); diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index ce5c3af..9222c9f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -118,7 +118,7 @@ static struct lu_device *osc2lu_dev(struct osc_device *osc) */ static void *osc_key_init(const struct lu_context *ctx, - struct lu_context_key *key) + struct lu_context_key *key) { struct osc_thread_info *info; @@ -248,14 +248,14 @@ static const struct lu_device_type_operations osc_device_type_ops = { .ldto_device_alloc = osc_device_alloc, .ldto_device_free = osc_device_free, - .ldto_device_init = osc_device_init, - .ldto_device_fini = osc_device_fini + .ldto_device_init = osc_device_init, + .ldto_device_fini = osc_device_fini }; struct lu_device_type osc_device_type = { - .ldt_tags = LU_DEVICE_CL, - .ldt_name = LUSTRE_OSC_NAME, - .ldt_ops = &osc_device_type_ops, + .ldt_tags = LU_DEVICE_CL, + .ldt_name = LUSTRE_OSC_NAME, + .ldt_ops = &osc_device_type_ops, .ldt_ctx_tags = LCT_CL_THREAD }; diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 3c7300b..fa24e9e 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -100,16 +100,16 @@ static int osc_io_submit(const struct lu_env *env, const struct cl_io_slice *ios, enum cl_req_type crt, struct cl_2queue *queue) { - struct cl_page *page; - struct cl_page *tmp; - struct client_obd *cli = NULL; - struct osc_object *osc = NULL; /* to keep gcc happy */ - struct osc_page *opg; - struct cl_io *io; + struct cl_page *page; + struct cl_page *tmp; + struct client_obd *cli = NULL; + struct osc_object *osc = NULL; /* to keep gcc happy */ + struct osc_page *opg; + struct cl_io *io; LIST_HEAD(list); - struct cl_page_list *qin = &queue->c2_qin; - struct cl_page_list *qout = &queue->c2_qout; + struct cl_page_list *qin = &queue->c2_qin; + struct cl_page_list *qout = &queue->c2_qout; int queued = 0; int result = 0; int cmd; @@ -189,8 +189,8 @@ static int osc_io_submit(const struct lu_env *env, static void osc_page_touch_at(const struct lu_env *env, struct cl_object *obj, pgoff_t idx, unsigned to) { - struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int valid; __u64 kms; @@ -233,8 +233,8 @@ static void osc_page_touch_at(const struct lu_env *env, static void osc_page_touch(const struct lu_env *env, struct osc_page *opage, unsigned to) { - struct cl_page *page = opage->ops_cl.cpl_page; - struct cl_object *obj = opage->ops_cl.cpl_obj; + struct cl_page *page = opage->ops_cl.cpl_page; + struct cl_object *obj = opage->ops_cl.cpl_obj; osc_page_touch_at(env, obj, page->cp_index, to); } @@ -260,7 +260,7 @@ static int osc_io_prepare_write(const struct lu_env *env, { struct osc_device *dev = lu2osc_dev(slice->cpl_obj->co_lu.lo_dev); struct obd_import *imp = class_exp2cliimp(dev->od_exp); - struct osc_io *oio = cl2osc_io(env, ios); + struct osc_io *oio = cl2osc_io(env, ios); int result = 0; /* @@ -284,9 +284,9 @@ static int osc_io_commit_write(const struct lu_env *env, const struct cl_page_slice *slice, unsigned from, unsigned to) { - struct osc_io *oio = cl2osc_io(env, ios); - struct osc_page *opg = cl2osc_page(slice); - struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); + struct osc_io *oio = cl2osc_io(env, ios); + struct osc_page *opg = cl2osc_page(slice); + struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); struct osc_async_page *oap = &opg->ops_oap; LASSERT(to > 0); @@ -311,10 +311,10 @@ static int osc_io_commit_write(const struct lu_env *env, static int osc_io_fault_start(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io; + struct cl_io *io; struct cl_fault_io *fio; - io = ios->cis_io; + io = ios->cis_io; fio = &io->u.ci_fault; CDEBUG(D_INFO, "%lu %d %d\n", fio->ft_index, fio->ft_writable, fio->ft_nob); @@ -375,11 +375,11 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, struct osc_io *oio, __u64 size) { struct cl_object *clob; - int partial; + int partial; pgoff_t start; - clob = oio->oi_cl.cis_obj; - start = cl_index(clob, size); + clob = oio->oi_cl.cis_obj; + start = cl_index(clob, size); partial = cl_offset(clob, start) < size; /* @@ -392,17 +392,17 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, static int osc_io_setattr_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_io *io = slice->cis_io; - struct osc_io *oio = cl2osc_io(env, slice); - struct cl_object *obj = slice->cis_obj; - struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; - struct obdo *oa = &oio->oi_oa; + struct cl_io *io = slice->cis_io; + struct osc_io *oio = cl2osc_io(env, slice); + struct cl_object *obj = slice->cis_obj; + struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct obdo *oa = &oio->oi_oa; struct osc_async_cbargs *cbargs = &oio->oi_cbarg; - __u64 size = io->u.ci_setattr.sa_attr.lvb_size; - unsigned int ia_valid = io->u.ci_setattr.sa_valid; - int result = 0; - struct obd_info oinfo = { { { 0 } } }; + __u64 size = io->u.ci_setattr.sa_attr.lvb_size; + unsigned int ia_valid = io->u.ci_setattr.sa_valid; + int result = 0; + struct obd_info oinfo = { { { 0 } } }; /* truncate cache dirty pages first */ if (cl_io_is_trunc(io)) @@ -477,8 +477,8 @@ static int osc_io_setattr_start(const struct lu_env *env, static void osc_io_setattr_end(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_io *io = slice->cis_io; - struct osc_io *oio = cl2osc_io(env, slice); + struct cl_io *io = slice->cis_io; + struct osc_io *oio = cl2osc_io(env, slice); struct cl_object *obj = slice->cis_obj; struct osc_async_cbargs *cbargs = &oio->oi_cbarg; int result = 0; @@ -512,8 +512,8 @@ static void osc_io_setattr_end(const struct lu_env *env, static int osc_io_read_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_object *obj = slice->cis_obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_object *obj = slice->cis_obj; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int rc = 0; if (!slice->cis_io->ci_noatime) { @@ -528,8 +528,8 @@ static int osc_io_read_start(const struct lu_env *env, static int osc_io_write_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_object *obj = slice->cis_obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_object *obj = slice->cis_obj; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; int rc = 0; OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1); @@ -544,10 +544,10 @@ static int osc_io_write_start(const struct lu_env *env, static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj, struct cl_fsync_io *fio) { - struct osc_io *oio = osc_env_io(env); - struct obdo *oa = &oio->oi_oa; - struct obd_info *oinfo = &oio->oi_info; - struct lov_oinfo *loi = obj->oo_oinfo; + struct osc_io *oio = osc_env_io(env); + struct obdo *oa = &oio->oi_oa; + struct obd_info *oinfo = &oio->oi_info; + struct lov_oinfo *loi = obj->oo_oinfo; struct osc_async_cbargs *cbargs = &oio->oi_cbarg; int rc = 0; @@ -575,13 +575,13 @@ static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj, static int osc_io_fsync_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct cl_io *io = slice->cis_io; + struct cl_io *io = slice->cis_io; struct cl_fsync_io *fio = &io->u.ci_fsync; - struct cl_object *obj = slice->cis_obj; - struct osc_object *osc = cl2osc(obj); - pgoff_t start = cl_index(obj, fio->fi_start); - pgoff_t end = cl_index(obj, fio->fi_end); - int result = 0; + struct cl_object *obj = slice->cis_obj; + struct osc_object *osc = cl2osc(obj); + pgoff_t start = cl_index(obj, fio->fi_start); + pgoff_t end = cl_index(obj, fio->fi_end); + int result = 0; if (fio->fi_end == OBD_OBJECT_EOF) end = CL_PAGE_EOF; @@ -615,15 +615,15 @@ static void osc_io_fsync_end(const struct lu_env *env, const struct cl_io_slice *slice) { struct cl_fsync_io *fio = &slice->cis_io->u.ci_fsync; - struct cl_object *obj = slice->cis_obj; + struct cl_object *obj = slice->cis_obj; pgoff_t start = cl_index(obj, fio->fi_start); - pgoff_t end = cl_index(obj, fio->fi_end); + pgoff_t end = cl_index(obj, fio->fi_end); int result = 0; if (fio->fi_mode == CL_FSYNC_LOCAL) { result = osc_cache_wait_range(env, cl2osc(obj), start, end); } else if (fio->fi_mode == CL_FSYNC_ALL) { - struct osc_io *oio = cl2osc_io(env, slice); + struct osc_io *oio = cl2osc_io(env, slice); struct osc_async_cbargs *cbargs = &oio->oi_cbarg; wait_for_completion(&cbargs->opc_sync); @@ -717,17 +717,17 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_req_attr *attr, u64 flags) { struct lov_oinfo *oinfo; - struct cl_req *clerq; - struct cl_page *apage; /* _some_ page in @clerq */ - struct cl_lock *lock; /* _some_ lock protecting @apage */ - struct osc_lock *olck; - struct osc_page *opg; - struct obdo *oa; - struct ost_lvb *lvb; - - oinfo = cl2osc(obj)->oo_oinfo; - lvb = &oinfo->loi_lvb; - oa = attr->cra_oa; + struct cl_req *clerq; + struct cl_page *apage; /* _some_ page in @clerq */ + struct cl_lock *lock; /* _some_ lock protecting @apage */ + struct osc_lock *olck; + struct osc_page *opg; + struct obdo *oa; + struct ost_lvb *lvb; + + oinfo = cl2osc(obj)->oo_oinfo; + lvb = &oinfo->loi_lvb; + oa = attr->cra_oa; if ((flags & OBD_MD_FLMTIME) != 0) { oa->o_mtime = lvb->lvb_mtime; @@ -759,7 +759,7 @@ static void osc_req_attr_set(const struct lu_env *env, lock = cl_lock_at_page(env, apage->cp_obj, apage, NULL, 1, 1); if (lock == NULL) { struct cl_object_header *head; - struct cl_lock *scan; + struct cl_lock *scan; head = cl_object_header(apage->cp_obj); list_for_each_entry(scan, &head->coh_locks, diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 350ad49..06837f5 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -89,9 +89,9 @@ static struct ldlm_lock *osc_handle_ptr(struct lustre_handle *handle) */ static int osc_lock_invariant(struct osc_lock *ols) { - struct ldlm_lock *lock = osc_handle_ptr(&ols->ols_handle); - struct ldlm_lock *olock = ols->ols_lock; - int handle_used = lustre_handle_is_used(&ols->ols_handle); + struct ldlm_lock *lock = osc_handle_ptr(&ols->ols_handle); + struct ldlm_lock *olock = ols->ols_lock; + int handle_used = lustre_handle_is_used(&ols->ols_handle); if (ergo(osc_lock_is_lockless(ols), ols->ols_locklessable && ols->ols_lock == NULL)) @@ -164,7 +164,7 @@ static void osc_lock_detach(const struct lu_env *env, struct osc_lock *olck) lock_res_and_lock(dlmlock); if (dlmlock->l_granted_mode == dlmlock->l_req_mode) { struct cl_object *obj = olck->ols_cl.cls_obj; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; __u64 old_kms; cl_object_attr_lock(obj); @@ -237,7 +237,7 @@ static int osc_lock_unuse(const struct lu_env *env, static void osc_lock_fini(const struct lu_env *env, struct cl_lock_slice *slice) { - struct osc_lock *ols = cl2osc_lock(slice); + struct osc_lock *ols = cl2osc_lock(slice); LINVRNT(osc_lock_invariant(ols)); /* @@ -337,25 +337,25 @@ static void osc_ast_data_put(const struct lu_env *env, struct osc_lock *olck) static void osc_lock_lvb_update(const struct lu_env *env, struct osc_lock *olck, int rc) { - struct ost_lvb *lvb; - struct cl_object *obj; - struct lov_oinfo *oinfo; - struct cl_attr *attr; - unsigned valid; + struct ost_lvb *lvb; + struct cl_object *obj; + struct lov_oinfo *oinfo; + struct cl_attr *attr; + unsigned valid; if (!(olck->ols_flags & LDLM_FL_LVB_READY)) return; - lvb = &olck->ols_lvb; - obj = olck->ols_cl.cls_obj; + lvb = &olck->ols_lvb; + obj = olck->ols_cl.cls_obj; oinfo = cl2osc(obj)->oo_oinfo; - attr = &osc_env_info(env)->oti_attr; + attr = &osc_env_info(env)->oti_attr; valid = CAT_BLOCKS | CAT_ATIME | CAT_CTIME | CAT_MTIME | CAT_SIZE; cl_lvb2attr(attr, lvb); cl_object_attr_lock(obj); if (rc == 0) { - struct ldlm_lock *dlmlock; + struct ldlm_lock *dlmlock; __u64 size; dlmlock = olck->ols_lock; @@ -401,23 +401,23 @@ static void osc_lock_lvb_update(const struct lu_env *env, struct osc_lock *olck, static void osc_lock_granted(const struct lu_env *env, struct osc_lock *olck, struct ldlm_lock *dlmlock, int rc) { - struct ldlm_extent *ext; - struct cl_lock *lock; + struct ldlm_extent *ext; + struct cl_lock *lock; struct cl_lock_descr *descr; LASSERT(dlmlock->l_granted_mode == dlmlock->l_req_mode); if (olck->ols_state < OLS_GRANTED) { - lock = olck->ols_cl.cls_lock; - ext = &dlmlock->l_policy_data.l_extent; + lock = olck->ols_cl.cls_lock; + ext = &dlmlock->l_policy_data.l_extent; descr = &osc_env_info(env)->oti_descr; descr->cld_obj = lock->cll_descr.cld_obj; /* XXX check that ->l_granted_mode is valid. */ - descr->cld_mode = osc_ldlm2cl_lock(dlmlock->l_granted_mode); + descr->cld_mode = osc_ldlm2cl_lock(dlmlock->l_granted_mode); descr->cld_start = cl_index(descr->cld_obj, ext->start); - descr->cld_end = cl_index(descr->cld_obj, ext->end); - descr->cld_gid = ext->gid; + descr->cld_end = cl_index(descr->cld_obj, ext->end); + descr->cld_gid = ext->gid; /* * tell upper layers the extent of the lock that was actually * granted @@ -482,11 +482,11 @@ static void osc_lock_upcall0(const struct lu_env *env, struct osc_lock *olck) */ static int osc_lock_upcall(void *cookie, int errcode) { - struct osc_lock *olck = cookie; - struct cl_lock_slice *slice = &olck->ols_cl; - struct cl_lock *lock = slice->cls_lock; - struct lu_env *env; - struct cl_env_nest nest; + struct osc_lock *olck = cookie; + struct cl_lock_slice *slice = &olck->ols_cl; + struct cl_lock *lock = slice->cls_lock; + struct lu_env *env; + struct cl_env_nest nest; env = cl_env_nested_get(&nest); if (!IS_ERR(env)) { @@ -626,7 +626,7 @@ static int osc_dlm_blocking_ast0(const struct lu_env *env, void *data, int flag) { struct osc_lock *olck; - struct cl_lock *lock; + struct cl_lock *lock; int result; int cancel; @@ -733,9 +733,9 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, struct ldlm_lock_desc *new, void *data, int flag) { - struct lu_env *env; + struct lu_env *env; struct cl_env_nest nest; - int result; + int result; /* * This can be called in the context of outer IO, e.g., @@ -774,9 +774,9 @@ static int osc_ldlm_completion_ast(struct ldlm_lock *dlmlock, __u64 flags, void *data) { struct cl_env_nest nest; - struct lu_env *env; - struct osc_lock *olck; - struct cl_lock *lock; + struct lu_env *env; + struct osc_lock *olck; + struct cl_lock *lock; int result; int dlmrc; @@ -830,15 +830,15 @@ static int osc_ldlm_completion_ast(struct ldlm_lock *dlmlock, static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) { - struct ptlrpc_request *req = data; + struct ptlrpc_request *req = data; struct osc_lock *olck; - struct cl_lock *lock; - struct cl_object *obj; - struct cl_env_nest nest; - struct lu_env *env; - struct ost_lvb *lvb; - struct req_capsule *cap; - int result; + struct cl_lock *lock; + struct cl_object *obj; + struct cl_env_nest nest; + struct lu_env *env; + struct ost_lvb *lvb; + struct req_capsule *cap; + int result; LASSERT(lustre_msg_get_opc(req->rq_reqmsg) == LDLM_GL_CALLBACK); @@ -916,11 +916,11 @@ static void osc_lock_build_einfo(const struct lu_env *env, */ mode = CLM_READ; - einfo->ei_type = LDLM_EXTENT; - einfo->ei_mode = osc_cl_lock2ldlm(mode); - einfo->ei_cb_bl = osc_ldlm_blocking_ast; - einfo->ei_cb_cp = osc_ldlm_completion_ast; - einfo->ei_cb_gl = osc_ldlm_glimpse_ast; + einfo->ei_type = LDLM_EXTENT; + einfo->ei_mode = osc_cl_lock2ldlm(mode); + einfo->ei_cb_bl = osc_ldlm_blocking_ast; + einfo->ei_cb_cp = osc_ldlm_completion_ast; + einfo->ei_cb_gl = osc_ldlm_glimpse_ast; einfo->ei_cbdata = lock; /* value to be put into ->l_ast_data */ } @@ -948,9 +948,9 @@ static void osc_lock_to_lockless(const struct lu_env *env, ols->ols_locklessable = 1; slice->cls_ops = &osc_lock_lockless_ops; } else { - struct osc_io *oio = osc_env_io(env); - struct cl_io *io = oio->oi_cl.cis_io; - struct cl_object *obj = slice->cls_obj; + struct osc_io *oio = osc_env_io(env); + struct cl_io *io = oio->oi_cl.cis_io; + struct cl_object *obj = slice->cls_obj; struct osc_object *oob = cl2osc(obj); const struct osc_device *osd = lu2osc_dev(obj->co_lu.lo_dev); struct obd_connect_data *ocd; @@ -1006,13 +1006,13 @@ static int osc_lock_compatible(const struct osc_lock *qing, static int osc_lock_enqueue_wait(const struct lu_env *env, const struct osc_lock *olck) { - struct cl_lock *lock = olck->ols_cl.cls_lock; - struct cl_lock_descr *descr = &lock->cll_descr; - struct cl_object_header *hdr = cl_object_header(descr->cld_obj); - struct cl_lock *scan; - struct cl_lock *conflict = NULL; - int lockless = osc_lock_is_lockless(olck); - int rc = 0; + struct cl_lock *lock = olck->ols_cl.cls_lock; + struct cl_lock_descr *descr = &lock->cll_descr; + struct cl_object_header *hdr = cl_object_header(descr->cld_obj); + struct cl_lock *scan; + struct cl_lock *conflict = NULL; + int lockless = osc_lock_is_lockless(olck); + int rc = 0; LASSERT(cl_lock_is_mutexed(lock)); @@ -1102,8 +1102,8 @@ static int osc_lock_enqueue(const struct lu_env *env, const struct cl_lock_slice *slice, struct cl_io *unused, __u32 enqflags) { - struct osc_lock *ols = cl2osc_lock(slice); - struct cl_lock *lock = ols->ols_cl.cls_lock; + struct osc_lock *ols = cl2osc_lock(slice); + struct cl_lock *lock = ols->ols_cl.cls_lock; int result; LASSERT(cl_lock_is_mutexed(lock)); @@ -1116,10 +1116,10 @@ static int osc_lock_enqueue(const struct lu_env *env, result = osc_lock_enqueue_wait(env, ols); if (result == 0) { if (!osc_lock_is_lockless(ols)) { - struct osc_object *obj = cl2osc(slice->cls_obj); - struct osc_thread_info *info = osc_env_info(env); - struct ldlm_res_id *resname = &info->oti_resname; - ldlm_policy_data_t *policy = &info->oti_policy; + struct osc_object *obj = cl2osc(slice->cls_obj); + struct osc_thread_info *info = osc_env_info(env); + struct ldlm_res_id *resname = &info->oti_resname; + ldlm_policy_data_t *policy = &info->oti_policy; struct ldlm_enqueue_info *einfo = &ols->ols_einfo; /* lock will be passed as upcall cookie, @@ -1164,7 +1164,7 @@ static int osc_lock_wait(const struct lu_env *env, const struct cl_lock_slice *slice) { struct osc_lock *olck = cl2osc_lock(slice); - struct cl_lock *lock = olck->ols_cl.cls_lock; + struct cl_lock *lock = olck->ols_cl.cls_lock; LINVRNT(osc_lock_invariant(olck)); @@ -1245,14 +1245,14 @@ static int osc_lock_use(const struct lu_env *env, static int osc_lock_flush(struct osc_lock *ols, int discard) { - struct cl_lock *lock = ols->ols_cl.cls_lock; - struct cl_env_nest nest; - struct lu_env *env; + struct cl_lock *lock = ols->ols_cl.cls_lock; + struct cl_env_nest nest; + struct lu_env *env; int result = 0; env = cl_env_nested_get(&nest); if (!IS_ERR(env)) { - struct osc_object *obj = cl2osc(ols->ols_cl.cls_obj); + struct osc_object *obj = cl2osc(ols->ols_cl.cls_obj); struct cl_lock_descr *descr = &lock->cll_descr; int rc = 0; @@ -1298,11 +1298,11 @@ static int osc_lock_flush(struct osc_lock *ols, int discard) static void osc_lock_cancel(const struct lu_env *env, const struct cl_lock_slice *slice) { - struct cl_lock *lock = slice->cls_lock; - struct osc_lock *olck = cl2osc_lock(slice); + struct cl_lock *lock = slice->cls_lock; + struct osc_lock *olck = cl2osc_lock(slice); struct ldlm_lock *dlmlock = olck->ols_lock; - int result = 0; - int discard; + int result = 0; + int discard; LASSERT(cl_lock_is_mutexed(lock)); LINVRNT(osc_lock_invariant(olck)); @@ -1482,7 +1482,7 @@ static int osc_lock_lockless_unuse(const struct lu_env *env, static void osc_lock_lockless_cancel(const struct lu_env *env, const struct cl_lock_slice *slice) { - struct osc_lock *ols = cl2osc_lock(slice); + struct osc_lock *ols = cl2osc_lock(slice); int result; result = osc_lock_flush(ols, 0); @@ -1496,7 +1496,7 @@ static int osc_lock_lockless_wait(const struct lu_env *env, const struct cl_lock_slice *slice) { struct osc_lock *olck = cl2osc_lock(slice); - struct cl_lock *lock = olck->ols_cl.cls_lock; + struct cl_lock *lock = olck->ols_cl.cls_lock; LINVRNT(osc_lock_invariant(olck)); LASSERT(olck->ols_state >= OLS_UPCALL_RECEIVED); @@ -1512,7 +1512,7 @@ static void osc_lock_lockless_state(const struct lu_env *env, LINVRNT(osc_lock_invariant(lock)); if (state == CLS_HELD) { - struct osc_io *oio = osc_env_io(env); + struct osc_io *oio = osc_env_io(env); LASSERT(ergo(lock->ols_owner, lock->ols_owner == oio)); lock->ols_owner = oio; @@ -1591,7 +1591,7 @@ int osc_lock_init(const struct lu_env *env, int osc_dlm_lock_pageref(struct ldlm_lock *dlm) { struct osc_lock *olock; - int rc = 0; + int rc = 0; spin_lock(&osc_ast_guard); olock = dlm->l_ast_data; diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index 92c202f..c628a25 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -72,7 +72,7 @@ static struct osc_object *lu2osc(const struct lu_object *obj) static int osc_object_init(const struct lu_env *env, struct lu_object *obj, const struct lu_object_conf *conf) { - struct osc_object *osc = lu2osc(obj); + struct osc_object *osc = lu2osc(obj); const struct cl_object_conf *cconf = lu2cl_conf(conf); int i; @@ -136,9 +136,9 @@ int osc_lvb_print(const struct lu_env *env, void *cookie, static int osc_object_print(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *obj) { - struct osc_object *osc = lu2osc(obj); - struct lov_oinfo *oinfo = osc->oo_oinfo; - struct osc_async_rc *ar = &oinfo->loi_ar; + struct osc_object *osc = lu2osc(obj); + struct lov_oinfo *oinfo = osc->oo_oinfo; + struct osc_async_rc *ar = &oinfo->loi_ar; (*p)(env, cookie, "id: " DOSTID " idx: %d gen: %d kms_valid: %u kms %llu rc: %d force_sync: %d min_xid: %llu ", POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, @@ -163,7 +163,7 @@ int osc_attr_set(const struct lu_env *env, struct cl_object *obj, const struct cl_attr *attr, unsigned valid) { struct lov_oinfo *oinfo = cl2osc(obj)->oo_oinfo; - struct ost_lvb *lvb = &oinfo->loi_lvb; + struct ost_lvb *lvb = &oinfo->loi_lvb; if (valid & CAT_SIZE) lvb->lvb_size = attr->cat_size; @@ -188,7 +188,7 @@ static int osc_object_glimpse(const struct lu_env *env, { struct lov_oinfo *oinfo = cl2osc(obj)->oo_oinfo; - lvb->lvb_size = oinfo->loi_kms; + lvb->lvb_size = oinfo->loi_kms; lvb->lvb_blocks = oinfo->loi_lvb.lvb_blocks; return 0; } @@ -208,9 +208,9 @@ void osc_object_clear_contended(struct osc_object *obj) int osc_object_is_contended(struct osc_object *obj) { - struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev); + struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev); int osc_contention_time = dev->od_contention_time; - unsigned long cur_time = cfs_time_current(); + unsigned long cur_time = cfs_time_current(); unsigned long retry_time; if (OBD_FAIL_CHECK(OBD_FAIL_OSC_OBJECT_CONTENTION)) @@ -255,7 +255,7 @@ struct lu_object *osc_object_alloc(const struct lu_env *env, struct lu_device *dev) { struct osc_object *osc; - struct lu_object *obj; + struct lu_object *obj; OBD_SLAB_ALLOC_PTR_GFP(osc, osc_object_kmem, GFP_NOFS); if (osc != NULL) { diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 76ba58b..43dfa73 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -216,7 +216,7 @@ static int osc_page_cache_add(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *io) { - struct osc_io *oio = osc_env_io(env); + struct osc_io *oio = osc_env_io(env); struct osc_page *opg = cl2osc_page(slice); int result; @@ -247,7 +247,7 @@ void osc_index2policy(ldlm_policy_data_t *policy, const struct cl_object *obj, { memset(policy, 0, sizeof(*policy)); policy->l_extent.start = cl_offset(obj, start); - policy->l_extent.end = cl_offset(obj, end + 1) - 1; + policy->l_extent.end = cl_offset(obj, end + 1) - 1; } static int osc_page_addref_lock(const struct lu_env *env, @@ -255,7 +255,7 @@ static int osc_page_addref_lock(const struct lu_env *env, struct cl_lock *lock) { struct osc_lock *olock; - int rc; + int rc; LASSERT(opg->ops_lock == NULL); @@ -274,7 +274,7 @@ static int osc_page_addref_lock(const struct lu_env *env, static void osc_page_putref_lock(const struct lu_env *env, struct osc_page *opg) { - struct cl_lock *lock = opg->ops_lock; + struct cl_lock *lock = opg->ops_lock; struct osc_lock *olock; LASSERT(lock != NULL); @@ -291,7 +291,7 @@ static int osc_page_is_under_lock(const struct lu_env *env, struct cl_io *unused) { struct cl_lock *lock; - int result = -ENODATA; + int result = -ENODATA; lock = cl_lock_at_page(env, slice->cpl_obj, slice->cpl_page, NULL, 1, 0); @@ -317,7 +317,7 @@ static void osc_page_completion_read(const struct lu_env *env, const struct cl_page_slice *slice, int ioret) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); if (likely(opg->ops_lock)) @@ -329,7 +329,7 @@ static void osc_page_completion_write(const struct lu_env *env, const struct cl_page_slice *slice, int ioret) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(slice->cpl_obj); osc_lru_add(osc_cli(obj), opg); @@ -364,10 +364,10 @@ static int osc_page_print(const struct lu_env *env, const struct cl_page_slice *slice, void *cookie, lu_printer_t printer) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_async_page *oap = &opg->ops_oap; - struct osc_object *obj = cl2osc(slice->cpl_obj); - struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; + struct osc_object *obj = cl2osc(slice->cpl_obj); + struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; return (*printer)(env, cookie, LUSTRE_OSC_NAME "-page@%p: 1< %#x %d %u %s %s > 2< %llu %u %u %#x %#x | %p %p %p > 3< %s %p %d %lu %d > 4< %d %d %d %lu %s | %s %s %s %s > 5< %s %s %s %s | %d %s | %d %s %s>\n", opg, @@ -408,7 +408,7 @@ static int osc_page_print(const struct lu_env *env, static void osc_page_delete(const struct lu_env *env, const struct cl_page_slice *slice) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj); int rc; @@ -437,13 +437,13 @@ static void osc_page_delete(const struct lu_env *env, void osc_page_clip(const struct lu_env *env, const struct cl_page_slice *slice, int from, int to) { - struct osc_page *opg = cl2osc_page(slice); + struct osc_page *opg = cl2osc_page(slice); struct osc_async_page *oap = &opg->ops_oap; LINVRNT(osc_page_protected(env, opg, CLM_READ, 0)); opg->ops_from = from; - opg->ops_to = to; + opg->ops_to = to; spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; spin_unlock(&oap->oap_lock); @@ -502,11 +502,11 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, struct page *vmpage) { struct osc_object *osc = cl2osc(obj); - struct osc_page *opg = cl_object_page_slice(obj, page); + struct osc_page *opg = cl_object_page_slice(obj, page); int result; opg->ops_from = 0; - opg->ops_to = PAGE_CACHE_SIZE; + opg->ops_to = PAGE_CACHE_SIZE; result = osc_prep_async_page(osc, opg, vmpage, cl_offset(obj, page->cp_index)); @@ -540,7 +540,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, enum cl_req_type crt, int brw_flags) { struct osc_async_page *oap = &opg->ops_oap; - struct osc_object *obj = oap->oap_obj; + struct osc_object *obj = oap->oap_obj; LINVRNT(osc_page_protected(env, opg, crt == CRT_WRITE ? CLM_WRITE : CLM_READ, 1)); @@ -550,9 +550,9 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, LASSERT(oap->oap_async_flags & ASYNC_READY); LASSERT(oap->oap_async_flags & ASYNC_COUNT_STABLE); - oap->oap_cmd = crt == CRT_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ; - oap->oap_page_off = opg->ops_from; - oap->oap_count = opg->ops_to - opg->ops_from; + oap->oap_cmd = crt == CRT_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ; + oap->oap_page_off = opg->ops_from; + oap->oap_count = opg->ops_to - opg->ops_from; oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags; if (!client_is_remote(osc_export(obj)) && diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c index 6690f14..2ff253f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_quota.c +++ b/drivers/staging/lustre/lustre/osc/osc_quota.c @@ -232,7 +232,7 @@ int osc_quota_setup(struct obd_device *obd) int osc_quota_cleanup(struct obd_device *obd) { - struct client_obd *cli = &obd->u.cli; + struct client_obd *cli = &obd->u.cli; int type; for (type = 0; type < MAXQUOTAS; type++) @@ -245,8 +245,8 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp, struct obd_quotactl *oqctl) { struct ptlrpc_request *req; - struct obd_quotactl *oqc; - int rc; + struct obd_quotactl *oqc; + int rc; req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_OST_QUOTACTL, LUSTRE_OST_VERSION, @@ -285,10 +285,10 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp, int osc_quotacheck(struct obd_device *unused, struct obd_export *exp, struct obd_quotactl *oqctl) { - struct client_obd *cli = &exp->exp_obd->u.cli; - struct ptlrpc_request *req; - struct obd_quotactl *body; - int rc; + struct client_obd *cli = &exp->exp_obd->u.cli; + struct ptlrpc_request *req; + struct obd_quotactl *body; + int rc; req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_OST_QUOTACHECK, LUSTRE_OST_VERSION, diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 6b6851a..c174de9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -264,7 +264,7 @@ static int osc_getattr_async(struct obd_export *exp, struct obd_info *oinfo, { struct ptlrpc_request *req; struct osc_async_args *aa; - int rc; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR); if (req == NULL) @@ -294,8 +294,8 @@ static int osc_getattr(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo) { struct ptlrpc_request *req; - struct ost_body *body; - int rc; + struct ost_body *body; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR); if (req == NULL) @@ -338,8 +338,8 @@ static int osc_setattr(const struct lu_env *env, struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti) { struct ptlrpc_request *req; - struct ost_body *body; - int rc; + struct ost_body *body; + int rc; LASSERT(oinfo->oi_oa->o_valid & OBD_MD_FLGROUP); @@ -403,9 +403,9 @@ int osc_setattr_async_base(struct obd_export *exp, struct obd_info *oinfo, obd_enqueue_update_f upcall, void *cookie, struct ptlrpc_request_set *rqset) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct osc_setattr_args *sa; - int rc; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR); if (req == NULL) @@ -460,9 +460,9 @@ int osc_real_create(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti) { struct ptlrpc_request *req; - struct ost_body *body; - struct lov_stripe_md *lsm; - int rc; + struct ost_body *body; + struct lov_stripe_md *lsm; + int rc; LASSERT(oa); LASSERT(ea); @@ -548,10 +548,10 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo, obd_enqueue_update_f upcall, void *cookie, struct ptlrpc_request_set *rqset) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct osc_setattr_args *sa; - struct ost_body *body; - int rc; + struct ost_body *body; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_PUNCH); if (req == NULL) @@ -577,7 +577,7 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo, req->rq_interpret_reply = (ptlrpc_interpterer_t)osc_setattr_interpret; CLASSERT (sizeof(*sa) <= sizeof(req->rq_async_args)); sa = ptlrpc_req_async_args(req); - sa->sa_oa = oinfo->oi_oa; + sa->sa_oa = oinfo->oi_oa; sa->sa_upcall = upcall; sa->sa_cookie = cookie; if (rqset == PTLRPCD_SET) @@ -616,9 +616,9 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo, struct ptlrpc_request_set *rqset) { struct ptlrpc_request *req; - struct ost_body *body; + struct ost_body *body; struct osc_fsync_args *fa; - int rc; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SYNC); if (req == NULL) @@ -757,9 +757,9 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, struct obd_trans_info *oti, struct obd_export *md_export, void *capa) { - struct client_obd *cli = &exp->exp_obd->u.cli; + struct client_obd *cli = &exp->exp_obd->u.cli; struct ptlrpc_request *req; - struct ost_body *body; + struct ost_body *body; LIST_HEAD(cancels); int rc, count; @@ -947,7 +947,7 @@ static int osc_shrink_grant(struct client_obd *cli) int osc_shrink_grant_to_target(struct client_obd *cli, __u64 target_bytes) { - int rc = 0; + int rc = 0; struct ost_body *body; client_obd_list_lock(&cli->cl_loi_list_lock); @@ -1131,8 +1131,8 @@ static int check_write_rcs(struct ptlrpc_request *req, int requested_nob, int niocount, u32 page_count, struct brw_page **pga) { - int i; - __u32 *remote_rcs; + int i; + __u32 *remote_rcs; remote_rcs = req_capsule_server_sized_get(&req->rq_pill, &RMF_RCS, sizeof(*remote_rcs) * @@ -1182,15 +1182,15 @@ static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2) } static u32 osc_checksum_bulk(int nob, u32 pg_count, - struct brw_page **pga, int opc, - cksum_type_t cksum_type) + struct brw_page **pga, int opc, + cksum_type_t cksum_type) { - __u32 cksum; - int i = 0; - struct cfs_crypto_hash_desc *hdesc; - unsigned int bufsize; - int err; - unsigned char cfs_alg = cksum_obd2cfs(cksum_type); + __u32 cksum; + int i = 0; + struct cfs_crypto_hash_desc *hdesc; + unsigned int bufsize; + int err; + unsigned char cfs_alg = cksum_obd2cfs(cksum_type); LASSERT(pg_count > 0); @@ -1250,14 +1250,14 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, struct obd_capa *ocapa, int reserve, int resend) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct ptlrpc_bulk_desc *desc; - struct ost_body *body; - struct obd_ioobj *ioobj; - struct niobuf_remote *niobuf; + struct ost_body *body; + struct obd_ioobj *ioobj; + struct niobuf_remote *niobuf; int niocount, i, requested_nob, opc, rc; struct osc_brw_async_args *aa; - struct req_capsule *pill; + struct req_capsule *pill; struct brw_page *pg_prev; if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ)) @@ -1359,8 +1359,8 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, niobuf->len += pg->count; } else { niobuf->offset = pg->off; - niobuf->len = pg->count; - niobuf->flags = pg->flag; + niobuf->len = pg->count; + niobuf->flags = pg->flag; } pg_prev = pg; } @@ -1581,9 +1581,9 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) if (body->oa.o_valid & OBD_MD_FLCKSUM) { static int cksum_counter; - __u32 server_cksum = body->oa.o_cksum; - char *via; - char *router; + __u32 server_cksum = body->oa.o_cksum; + char *via; + char *router; cksum_type_t cksum_type; cksum_type = cksum_type_unpack(body->oa.o_valid &OBD_MD_FLFLAGS? @@ -1758,7 +1758,7 @@ static int brw_interpret(const struct lu_env *env, struct osc_brw_async_args *aa = data; struct osc_extent *ext; struct osc_extent *tmp; - struct cl_object *obj = NULL; + struct cl_object *obj = NULL; struct client_obd *cli = aa->aa_cli; rc = osc_brw_fini_request(req, rc); @@ -1862,26 +1862,25 @@ static int brw_interpret(const struct lu_env *env, int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, struct list_head *ext_list, int cmd, pdl_policy_t pol) { - struct ptlrpc_request *req = NULL; - struct osc_extent *ext; - struct brw_page **pga = NULL; - struct osc_brw_async_args *aa = NULL; - struct obdo *oa = NULL; - struct osc_async_page *oap; - struct osc_async_page *tmp; - struct cl_req *clerq = NULL; - enum cl_req_type crt = (cmd & OBD_BRW_WRITE) ? CRT_WRITE : - CRT_READ; - struct ldlm_lock *lock = NULL; - struct cl_req_attr *crattr = NULL; - u64 starting_offset = OBD_OBJECT_EOF; - u64 ending_offset = 0; - int mpflag = 0; - int mem_tight = 0; - int page_count = 0; - int i; - int rc; - struct ost_body *body; + struct ptlrpc_request *req = NULL; + struct osc_extent *ext; + struct brw_page **pga = NULL; + struct osc_brw_async_args *aa = NULL; + struct obdo *oa = NULL; + struct osc_async_page *oap; + struct osc_async_page *tmp; + struct cl_req *clerq = NULL; + enum cl_req_type crt = (cmd & OBD_BRW_WRITE) ? CRT_WRITE : CRT_READ; + struct ldlm_lock *lock = NULL; + struct cl_req_attr *crattr = NULL; + u64 starting_offset = OBD_OBJECT_EOF; + u64 ending_offset = 0; + int mpflag = 0; + int mem_tight = 0; + int page_count = 0; + int i; + int rc; + struct ost_body *body; LIST_HEAD(rpc_list); LASSERT(!list_empty(ext_list)); @@ -2480,10 +2479,10 @@ static int osc_statfs_async(struct obd_export *exp, struct obd_info *oinfo, __u64 max_age, struct ptlrpc_request_set *rqset) { - struct obd_device *obd = class_exp2obd(exp); + struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; struct osc_async_args *aa; - int rc; + int rc; /* We could possibly pass max_age in the request (as an absolute * timestamp or a "seconds.usec ago") so the target can avoid doing @@ -2522,10 +2521,10 @@ static int osc_statfs_async(struct obd_export *exp, static int osc_statfs(const struct lu_env *env, struct obd_export *exp, struct obd_statfs *osfs, __u64 max_age, __u32 flags) { - struct obd_device *obd = class_exp2obd(exp); - struct obd_statfs *msfs; + struct obd_device *obd = class_exp2obd(exp); + struct obd_statfs *msfs; struct ptlrpc_request *req; - struct obd_import *imp = NULL; + struct obd_import *imp = NULL; int rc; /*Since the request might also come from lprocfs, so we need @@ -2749,9 +2748,9 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp, return 0; } else if (KEY_IS(KEY_LAST_ID)) { struct ptlrpc_request *req; - u64 *reply; - char *tmp; - int rc; + u64 *reply; + char *tmp; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GET_INFO_LAST_ID); @@ -2788,14 +2787,14 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp, } else if (KEY_IS(KEY_FIEMAP)) { struct ll_fiemap_info_key *fm_key = (struct ll_fiemap_info_key *)key; - struct ldlm_res_id res_id; - ldlm_policy_data_t policy; - struct lustre_handle lockh; - ldlm_mode_t mode = 0; - struct ptlrpc_request *req; - struct ll_user_fiemap *reply; - char *tmp; - int rc; + struct ldlm_res_id res_id; + ldlm_policy_data_t policy; + struct lustre_handle lockh; + ldlm_mode_t mode = 0; + struct ptlrpc_request *req; + struct ll_user_fiemap *reply; + char *tmp; + int rc; if (!(fm_key->fiemap.fm_flags & FIEMAP_FLAG_SYNC)) goto skip_locking; @@ -2881,10 +2880,10 @@ static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp, void *val, struct ptlrpc_request_set *set) { struct ptlrpc_request *req; - struct obd_device *obd = exp->exp_obd; - struct obd_import *imp = class_exp2cliimp(exp); - char *tmp; - int rc; + struct obd_device *obd = exp->exp_obd; + struct obd_import *imp = class_exp2cliimp(exp); + char *tmp; + int rc; OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_SHUTDOWN, 10); @@ -3071,8 +3070,8 @@ static int osc_import_event(struct obd_device *obd, } case IMP_EVENT_INVALIDATE: { struct ldlm_namespace *ns = obd->obd_namespace; - struct lu_env *env; - int refcheck; + struct lu_env *env; + int refcheck; env = cl_env_get(&refcheck); if (!IS_ERR(env)) { @@ -3159,9 +3158,9 @@ static int brw_queue_work(const struct lu_env *env, void *data) int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { struct lprocfs_static_vars lvars = { NULL }; - struct client_obd *cli = &obd->u.cli; - void *handler; - int rc; + struct client_obd *cli = &obd->u.cli; + void *handler; + int rc; rc = ptlrpcd_addref(); if (rc) -- 1.7.1 From hannac at iu.edu Wed Jun 3 14:28:26 2015 From: hannac at iu.edu (Chris Hanna) Date: Wed, 3 Jun 2015 10:28:26 -0400 Subject: [lustre-devel] [PATCH] staging: lustre: ptlrpc: clean up whitespace and align function params Message-ID: <1433341706-8073-1-git-send-email-hannac@iu.edu> Minor changes to remove excessive whitespace and improve readability of ptlrpc functions. Signed-off-by: Chris Hanna --- drivers/staging/lustre/lustre/ptlrpc/client.c | 90 ++++---- drivers/staging/lustre/lustre/ptlrpc/events.c | 60 +++--- drivers/staging/lustre/lustre/ptlrpc/import.c | 8 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 70 +++--- drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 82 ++++---- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 104 +++++----- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 62 +++--- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 146 ++++++------ drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 4 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 18 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 96 ++++---- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 48 ++-- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 60 +++--- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 8 +- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 78 ++++---- drivers/staging/lustre/lustre/ptlrpc/service.c | 238 ++++++++++---------- 20 files changed, 594 insertions(+), 594 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 347110e..35ebe0f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -57,8 +57,8 @@ void ptlrpc_init_client(int req_portal, int rep_portal, char *name, struct ptlrpc_client *cl) { cl->cli_request_portal = req_portal; - cl->cli_reply_portal = rep_portal; - cl->cli_name = name; + cl->cli_reply_portal = rep_portal; + cl->cli_name = name; } EXPORT_SYMBOL(ptlrpc_init_client); @@ -68,9 +68,9 @@ EXPORT_SYMBOL(ptlrpc_init_client); struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid) { struct ptlrpc_connection *c; - lnet_nid_t self; - lnet_process_id_t peer; - int err; + lnet_nid_t self; + lnet_process_id_t peer; + int err; /* ptlrpc_uuid_to_peer() initializes its 2nd parameter * before accessing its values. */ @@ -148,7 +148,7 @@ struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req, desc->bd_import = class_import_get(imp); desc->bd_req = req; - desc->bd_cbid.cbid_fn = client_bulk_callback; + desc->bd_cbid.cbid_fn = client_bulk_callback; desc->bd_cbid.cbid_arg = desc; /* This makes req own desc, and free it when she frees herself */ @@ -343,8 +343,8 @@ static int unpack_reply(struct ptlrpc_request *req) static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req) { struct ptlrpc_request *early_req; - time_t olddl; - int rc; + time_t olddl; + int rc; req->rq_early = 0; spin_unlock(&req->rq_lock); @@ -580,8 +580,8 @@ static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request, int count, __u32 *lengths, char **bufs, struct ptlrpc_cli_ctx *ctx) { - struct obd_import *imp = request->rq_import; - int rc; + struct obd_import *imp = request->rq_import; + int rc; if (unlikely(ctx)) request->rq_cli_ctx = sptlrpc_cli_ctx_get(ctx); @@ -605,10 +605,10 @@ static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request, request->rq_type = PTL_RPC_MSG_REQUEST; request->rq_export = NULL; - request->rq_req_cbid.cbid_fn = request_out_callback; + request->rq_req_cbid.cbid_fn = request_out_callback; request->rq_req_cbid.cbid_arg = request; - request->rq_reply_cbid.cbid_fn = reply_in_callback; + request->rq_reply_cbid.cbid_fn = reply_in_callback; request->rq_reply_cbid.cbid_arg = request; request->rq_reply_deadline = 0; @@ -761,8 +761,8 @@ EXPORT_SYMBOL(ptlrpc_request_alloc); * initialize its buffer structure according to capsule template \a format. */ struct ptlrpc_request *ptlrpc_request_alloc_pool(struct obd_import *imp, - struct ptlrpc_request_pool *pool, - const struct req_format *format) + struct ptlrpc_request_pool *pool, + const struct req_format *format) { return ptlrpc_request_alloc_internal(imp, pool, format); } @@ -789,11 +789,11 @@ EXPORT_SYMBOL(ptlrpc_request_free); * Returns allocated request or NULL on error. */ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp, - const struct req_format *format, - __u32 version, int opcode) + const struct req_format *format, + __u32 version, int opcode) { struct ptlrpc_request *req = ptlrpc_request_alloc(imp, format); - int rc; + int rc; if (req) { rc = ptlrpc_request_pack(req, version, opcode); @@ -820,7 +820,7 @@ ptlrpc_prep_req_pool(struct obd_import *imp, struct ptlrpc_request_pool *pool) { struct ptlrpc_request *request; - int rc; + int rc; request = __ptlrpc_request_alloc(imp, pool); if (!request) @@ -868,9 +868,9 @@ struct ptlrpc_request_set *ptlrpc_prep_set(void) INIT_LIST_HEAD(&set->set_new_requests); INIT_LIST_HEAD(&set->set_cblist); set->set_max_inflight = UINT_MAX; - set->set_producer = NULL; + set->set_producer = NULL; set->set_producer_arg = NULL; - set->set_rc = 0; + set->set_rc = 0; return set; } @@ -894,9 +894,9 @@ struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func, if (!set) return NULL; - set->set_max_inflight = max; - set->set_producer = func; - set->set_producer_arg = arg; + set->set_max_inflight = max; + set->set_producer = func; + set->set_producer_arg = arg; return set; } @@ -912,10 +912,10 @@ EXPORT_SYMBOL(ptlrpc_prep_fcset); */ void ptlrpc_set_destroy(struct ptlrpc_request_set *set) { - struct list_head *tmp; - struct list_head *next; - int expected_phase; - int n = 0; + struct list_head *tmp; + struct list_head *next; + int expected_phase; + int n = 0; /* Requests on the set should either all be completed, or all be new */ expected_phase = (atomic_read(&set->set_remaining) == 0) ? @@ -1013,7 +1013,7 @@ EXPORT_SYMBOL(ptlrpc_set_add_req); * Currently only used for ptlrpcd. */ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc, - struct ptlrpc_request *req) + struct ptlrpc_request *req) { struct ptlrpc_request_set *set = pc->pc_set; int count, i; @@ -1400,7 +1400,7 @@ static int after_reply(struct ptlrpc_request *req) */ static int ptlrpc_send_new_req(struct ptlrpc_request *req) { - struct obd_import *imp = req->rq_import; + struct obd_import *imp = req->rq_import; int rc; LASSERT(req->rq_phase == RQ_PHASE_NEW); @@ -1669,7 +1669,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) continue; } - if (status != 0) { + if (status != 0) { req->rq_status = status; ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); @@ -1969,8 +1969,8 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) int ptlrpc_expired_set(void *data) { struct ptlrpc_request_set *set = data; - struct list_head *tmp; - time_t now = get_seconds(); + struct list_head *tmp; + time_t now = get_seconds(); LASSERT(set != NULL); @@ -2052,11 +2052,11 @@ EXPORT_SYMBOL(ptlrpc_interrupted_set); */ int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set) { - struct list_head *tmp; - time_t now = get_seconds(); - int timeout = 0; + struct list_head *tmp; + time_t now = get_seconds(); + int timeout = 0; struct ptlrpc_request *req; - int deadline; + int deadline; list_for_each(tmp, &set->set_requests) { req = list_entry(tmp, struct ptlrpc_request, rq_set_chain); @@ -2105,10 +2105,10 @@ EXPORT_SYMBOL(ptlrpc_set_next_timeout); */ int ptlrpc_set_wait(struct ptlrpc_request_set *set) { - struct list_head *tmp; + struct list_head *tmp; struct ptlrpc_request *req; - struct l_wait_info lwi; - int rc, timeout; + struct l_wait_info lwi; + int rc, timeout; if (set->set_producer) (void)ptlrpc_set_producer(set); @@ -2353,8 +2353,8 @@ EXPORT_SYMBOL(ptlrpc_req_xid); */ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async) { - int rc; - wait_queue_head_t *wq; + int rc; + wait_queue_head_t *wq; struct l_wait_info lwi; /* @@ -2471,7 +2471,7 @@ void ptlrpc_free_committed(struct obd_import *imp) { struct ptlrpc_request *req, *saved; struct ptlrpc_request *last_req = NULL; /* temporary fire escape */ - bool skip_committed_list = true; + bool skip_committed_list = true; LASSERT(imp != NULL); assert_spin_locked(&imp->imp_lock); @@ -3023,8 +3023,8 @@ EXPORT_SYMBOL(ptlrpc_sample_next_xid); * have delay before it really runs by ptlrpcd thread. */ struct ptlrpc_work_async_args { - int (*cb)(const struct lu_env *, void *); - void *cbdata; + int (*cb)(const struct lu_env *, void *); + void *cbdata; }; static void ptlrpcd_add_work_req(struct ptlrpc_request *req) @@ -3113,7 +3113,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args)); args = ptlrpc_req_async_args(req); - args->cb = cb; + args->cb = cb; args->cbdata = cbdata; return req; diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 7f8644e..8cb1929 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -53,7 +53,7 @@ lnet_handle_eq_t ptlrpc_eq_h; */ void request_out_callback(lnet_event_t *ev) { - struct ptlrpc_cb_id *cbid = ev->md.user_ptr; + struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_request *req = cbid->cbid_arg; LASSERT(ev->type == LNET_EVENT_SEND || @@ -86,7 +86,7 @@ void request_out_callback(lnet_event_t *ev) */ void reply_in_callback(lnet_event_t *ev) { - struct ptlrpc_cb_id *cbid = ev->md.user_ptr; + struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_request *req = cbid->cbid_arg; DEBUG_REQ(D_NET, req, "type %d, status %d", ev->type, ev->status); @@ -172,9 +172,9 @@ out_wake: */ void client_bulk_callback(lnet_event_t *ev) { - struct ptlrpc_cb_id *cbid = ev->md.user_ptr; + struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_bulk_desc *desc = cbid->cbid_arg; - struct ptlrpc_request *req; + struct ptlrpc_request *req; LASSERT((desc->bd_type == BULK_PUT_SINK && ev->type == LNET_EVENT_PUT) || @@ -245,9 +245,9 @@ void client_bulk_callback(lnet_event_t *ev) static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt, struct ptlrpc_request *req) { - __u64 sec = req->rq_arrival_time.tv_sec; - __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */ - __u64 new_seq; + __u64 sec = req->rq_arrival_time.tv_sec; + __u32 usec = req->rq_arrival_time.tv_usec >> 4; /* usec / 16 */ + __u64 new_seq; /* set sequence ID for request and add it to history list, * it must be called with hold svcpt::scp_lock */ @@ -281,11 +281,11 @@ static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt, */ void request_in_callback(lnet_event_t *ev) { - struct ptlrpc_cb_id *cbid = ev->md.user_ptr; + struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_request_buffer_desc *rqbd = cbid->cbid_arg; - struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt; - struct ptlrpc_service *service = svcpt->scp_service; - struct ptlrpc_request *req; + struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt; + struct ptlrpc_service *service = svcpt->scp_service; + struct ptlrpc_request *req; LASSERT(ev->type == LNET_EVENT_PUT || ev->type == LNET_EVENT_UNLINK); @@ -380,7 +380,7 @@ void request_in_callback(lnet_event_t *ev) */ void reply_out_callback(lnet_event_t *ev) { - struct ptlrpc_cb_id *cbid = ev->md.user_ptr; + struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_reply_state *rs = cbid->cbid_arg; struct ptlrpc_service_part *svcpt = rs->rs_svcpt; @@ -433,17 +433,17 @@ static void ptlrpc_master_callback(lnet_event_t *ev) } int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, - lnet_process_id_t *peer, lnet_nid_t *self) + lnet_process_id_t *peer, lnet_nid_t *self) { - int best_dist = 0; - __u32 best_order = 0; - int count = 0; - int rc = -ENOENT; - int portals_compatibility; - int dist; - __u32 order; - lnet_nid_t dst_nid; - lnet_nid_t src_nid; + int best_dist = 0; + __u32 best_order = 0; + int count = 0; + int rc = -ENOENT; + int portals_compatibility; + int dist; + __u32 order; + lnet_nid_t dst_nid; + lnet_nid_t src_nid; portals_compatibility = LNetCtl(IOC_LIBCFS_PORTALS_COMPATIBILITY, NULL); @@ -487,10 +487,10 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, void ptlrpc_ni_fini(void) { - wait_queue_head_t waitq; - struct l_wait_info lwi; - int rc; - int retries; + wait_queue_head_t waitq; + struct l_wait_info lwi; + int rc; + int retries; /* Wait for the event queue to become idle since there may still be * messages in flight with pending events (i.e. the fire-and-forget @@ -523,7 +523,7 @@ void ptlrpc_ni_fini(void) lnet_pid_t ptl_get_pid(void) { - lnet_pid_t pid; + lnet_pid_t pid; pid = LUSTRE_SRV_LNET_PID; return pid; @@ -531,8 +531,8 @@ lnet_pid_t ptl_get_pid(void) int ptlrpc_ni_init(void) { - int rc; - lnet_pid_t pid; + int rc; + lnet_pid_t pid; pid = ptl_get_pid(); CDEBUG(D_NET, "My pid is: %x\n", pid); @@ -563,7 +563,7 @@ int ptlrpc_ni_init(void) int ptlrpc_init_portals(void) { - int rc = ptlrpc_ni_init(); + int rc = ptlrpc_ni_init(); if (rc != 0) { CERROR("network initialisation failed\n"); diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index d5fc689..c9b8481 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -119,7 +119,7 @@ int ptlrpc_init_import(struct obd_import *imp) spin_lock(&imp->imp_lock); imp->imp_generation++; - imp->imp_state = LUSTRE_IMP_NEW; + imp->imp_state = LUSTRE_IMP_NEW; spin_unlock(&imp->imp_lock); @@ -369,7 +369,7 @@ void ptlrpc_invalidate_import(struct obd_import *imp) imp_unregistering)); } spin_unlock(&imp->imp_lock); - } + } } while (rc != 0); /* @@ -559,7 +559,7 @@ static int import_select_connection(struct obd_import *imp) ptlrpc_connection_put(imp->imp_connection); imp->imp_connection = ptlrpc_connection_addref(imp_conn->oic_conn); - dlmexp = class_conn2export(&imp->imp_dlm_handle); + dlmexp = class_conn2export(&imp->imp_dlm_handle); LASSERT(dlmexp != NULL); if (dlmexp->exp_connection) ptlrpc_connection_put(dlmexp->exp_connection); @@ -1490,7 +1490,7 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) INITIAL_CONNECT_TIMEOUT); IMPORT_SET_STATE(imp, LUSTRE_IMP_CONNECTING); - req->rq_send_state = LUSTRE_IMP_CONNECTING; + req->rq_send_state = LUSTRE_IMP_CONNECTING; ptlrpc_request_set_replen(req); rc = ptlrpc_queue_wait(req); ptlrpc_req_finished(req); diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index a42335e..d14c200 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -807,11 +807,11 @@ struct req_capsule; /* * Request fields. */ -#define DEFINE_MSGF(name, flags, size, swabber, dumper) { \ - .rmf_name = (name), \ - .rmf_flags = (flags), \ - .rmf_size = (size), \ - .rmf_swabber = (void (*)(void *))(swabber), \ +#define DEFINE_MSGF(name, flags, size, swabber, dumper) { \ + .rmf_name = (name), \ + .rmf_flags = (flags), \ + .rmf_size = (size), \ + .rmf_swabber = (void (*)(void *))(swabber), \ .rmf_dumper = (void (*)(void *))(dumper) \ } @@ -1164,25 +1164,25 @@ EXPORT_SYMBOL(RMF_SWAP_LAYOUTS); struct req_format { const char *rf_name; - int rf_idx; + int rf_idx; struct { - int nr; + int nr; const struct req_msg_field **d; } rf_fields[RCL_NR]; }; -#define DEFINE_REQ_FMT(name, client, client_nr, server, server_nr) { \ - .rf_name = name, \ - .rf_fields = { \ +#define DEFINE_REQ_FMT(name, client, client_nr, server, server_nr) { \ + .rf_name = name, \ + .rf_fields = { \ [RCL_CLIENT] = { \ .nr = client_nr, \ - .d = client \ - }, \ + .d = client \ + }, \ [RCL_SERVER] = { \ .nr = server_nr, \ - .d = server \ - } \ - } \ + .d = server \ + } \ + } \ } #define DEFINE_REQ_FMT0(name, client, server) \ @@ -1769,10 +1769,10 @@ EXPORT_SYMBOL(req_capsule_set); * field of a \a pill's \a rc_fmt's RMF's. */ int req_capsule_filled_sizes(struct req_capsule *pill, - enum req_location loc) + enum req_location loc) { const struct req_format *fmt = pill->rc_fmt; - int i; + int i; LASSERT(fmt != NULL); @@ -1806,8 +1806,8 @@ EXPORT_SYMBOL(req_capsule_filled_sizes); int req_capsule_server_pack(struct req_capsule *pill) { const struct req_format *fmt; - int count; - int rc; + int count; + int rc; LASSERT(pill->rc_loc == RCL_SERVER); fmt = pill->rc_fmt; @@ -1857,11 +1857,11 @@ swabber_dumper_helper(struct req_capsule *pill, int offset, void *value, int len, int dump, void (*swabber)(void *)) { - void *p; - int i; - int n; - int do_swab; - int inout = loc == RCL_CLIENT; + void *p; + int i; + int n; + int do_swab; + int inout = loc == RCL_CLIENT; swabber = swabber ?: field->rmf_swabber; @@ -1936,10 +1936,10 @@ static void *__req_capsule_get(struct req_capsule *pill, int dump) { const struct req_format *fmt; - struct lustre_msg *msg; - void *value; - int len; - int offset; + struct lustre_msg *msg; + void *value; + int len; + int offset; void *(*getter)(struct lustre_msg *m, int n, int minlen); @@ -2000,10 +2000,10 @@ static void *__req_capsule_get(struct req_capsule *pill, */ static void __req_capsule_dump(struct req_capsule *pill, enum req_location loc) { - const struct req_format *fmt; - const struct req_msg_field *field; - int len; - int i; + const struct req_format *fmt; + const struct req_msg_field *field; + int len; + int i; fmt = pill->rc_fmt; @@ -2350,9 +2350,9 @@ void req_capsule_shrink(struct req_capsule *pill, enum req_location loc) { const struct req_format *fmt; - struct lustre_msg *msg; - int len; - int offset; + struct lustre_msg *msg; + int len; + int offset; fmt = pill->rc_fmt; LASSERT(fmt != NULL); diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c index e9baf5b..1c701e0 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c @@ -49,29 +49,29 @@ #include "../include/lustre_net.h" #include -#define LLOG_CLIENT_ENTRY(ctxt, imp) do { \ - mutex_lock(&ctxt->loc_mutex); \ - if (ctxt->loc_imp) { \ - imp = class_import_get(ctxt->loc_imp); \ - } else { \ - CERROR("ctxt->loc_imp == NULL for context idx %d." \ - "Unable to complete MDS/OSS recovery," \ - "but I'll try again next time. Not fatal.\n", \ - ctxt->loc_idx); \ - imp = NULL; \ - mutex_unlock(&ctxt->loc_mutex); \ - return (-EINVAL); \ - } \ - mutex_unlock(&ctxt->loc_mutex); \ +#define LLOG_CLIENT_ENTRY(ctxt, imp) do { \ + mutex_lock(&ctxt->loc_mutex); \ + if (ctxt->loc_imp) { \ + imp = class_import_get(ctxt->loc_imp); \ + } else { \ + CERROR("ctxt->loc_imp == NULL for context idx %d." \ + "Unable to complete MDS/OSS recovery," \ + "but I'll try again next time. Not fatal.\n", \ + ctxt->loc_idx); \ + imp = NULL; \ + mutex_unlock(&ctxt->loc_mutex); \ + return (-EINVAL); \ + } \ + mutex_unlock(&ctxt->loc_mutex); \ } while (0) -#define LLOG_CLIENT_EXIT(ctxt, imp) do { \ - mutex_lock(&ctxt->loc_mutex); \ - if (ctxt->loc_imp != imp) \ - CWARN("loc_imp has changed from %p to %p\n", \ - ctxt->loc_imp, imp); \ - class_import_put(imp); \ - mutex_unlock(&ctxt->loc_mutex); \ +#define LLOG_CLIENT_EXIT(ctxt, imp) do { \ + mutex_lock(&ctxt->loc_mutex); \ + if (ctxt->loc_imp != imp) \ + CWARN("loc_imp has changed from %p to %p\n", \ + ctxt->loc_imp, imp); \ + class_import_put(imp); \ + mutex_unlock(&ctxt->loc_mutex); \ } while (0) /* This is a callback from the llog_* functions. @@ -80,11 +80,11 @@ static int llog_client_open(const struct lu_env *env, struct llog_handle *lgh, struct llog_logid *logid, char *name, enum llog_open_param open_param) { - struct obd_import *imp; - struct llogd_body *body; - struct llog_ctxt *ctxt = lgh->lgh_ctxt; + struct obd_import *imp; + struct llogd_body *body; + struct llog_ctxt *ctxt = lgh->lgh_ctxt; struct ptlrpc_request *req = NULL; - int rc; + int rc; LLOG_CLIENT_ENTRY(ctxt, imp); @@ -145,10 +145,10 @@ out: static int llog_client_destroy(const struct lu_env *env, struct llog_handle *loghandle) { - struct obd_import *imp; + struct obd_import *imp; struct ptlrpc_request *req = NULL; - struct llogd_body *body; - int rc; + struct llogd_body *body; + int rc; LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp); req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_DESTROY, @@ -182,11 +182,11 @@ static int llog_client_next_block(const struct lu_env *env, int *cur_idx, int next_idx, __u64 *cur_offset, void *buf, int len) { - struct obd_import *imp; + struct obd_import *imp; struct ptlrpc_request *req = NULL; - struct llogd_body *body; - void *ptr; - int rc; + struct llogd_body *body; + void *ptr; + int rc; LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp); req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK, @@ -240,11 +240,11 @@ static int llog_client_prev_block(const struct lu_env *env, struct llog_handle *loghandle, int prev_idx, void *buf, int len) { - struct obd_import *imp; + struct obd_import *imp; struct ptlrpc_request *req = NULL; - struct llogd_body *body; - void *ptr; - int rc; + struct llogd_body *body; + void *ptr; + int rc; LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp); req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK, @@ -292,12 +292,12 @@ err_exit: static int llog_client_read_header(const struct lu_env *env, struct llog_handle *handle) { - struct obd_import *imp; + struct obd_import *imp; struct ptlrpc_request *req = NULL; - struct llogd_body *body; - struct llog_log_hdr *hdr; - struct llog_rec_hdr *llh_hdr; - int rc; + struct llogd_body *body; + struct llog_log_hdr *hdr; + struct llog_rec_hdr *llh_hdr; + int rc; LLOG_CLIENT_ENTRY(handle->lgh_ctxt, imp); req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER, diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 1362160..c04ae50 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -261,8 +261,8 @@ ptlrpc_lprocfs_req_history_len_seq_show(struct seq_file *m, void *v) { struct ptlrpc_service *svc = m->private; struct ptlrpc_service_part *svcpt; - int total = 0; - int i; + int total = 0; + int i; ptlrpc_service_for_each_part(svcpt, i, svc) total += svcpt->scp_hist_nrqbds; @@ -277,8 +277,8 @@ ptlrpc_lprocfs_req_history_max_seq_show(struct seq_file *m, void *n) { struct ptlrpc_service *svc = m->private; struct ptlrpc_service_part *svcpt; - int total = 0; - int i; + int total = 0; + int i; ptlrpc_service_for_each_part(svcpt, i, svc) total += svc->srv_hist_nrqbds_cpt_max; @@ -289,13 +289,13 @@ ptlrpc_lprocfs_req_history_max_seq_show(struct seq_file *m, void *n) static ssize_t ptlrpc_lprocfs_req_history_max_seq_write(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) + const char __user *buffer, + size_t count, loff_t *off) { struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private; - int bufpages; - int val; - int rc; + int bufpages; + int val; + int rc; rc = lprocfs_write_helper(buffer, count, &val); if (rc < 0) @@ -478,17 +478,17 @@ void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, */ static int ptlrpc_lprocfs_nrs_seq_show(struct seq_file *m, void *n) { - struct ptlrpc_service *svc = m->private; - struct ptlrpc_service_part *svcpt; - struct ptlrpc_nrs *nrs; - struct ptlrpc_nrs_policy *policy; - struct ptlrpc_nrs_pol_info *infos; - struct ptlrpc_nrs_pol_info tmp; - unsigned num_pols; - unsigned pol_idx = 0; - bool hp = false; - int i; - int rc = 0; + struct ptlrpc_service *svc = m->private; + struct ptlrpc_service_part *svcpt; + struct ptlrpc_nrs *nrs; + struct ptlrpc_nrs_policy *policy; + struct ptlrpc_nrs_pol_info *infos; + struct ptlrpc_nrs_pol_info tmp; + unsigned num_pols; + unsigned pol_idx = 0; + bool hp = false; + int i; + int rc = 0; /** * Serialize NRS core lprocfs operations with policy registration/ @@ -638,15 +638,15 @@ unlock: * regular and high-priority (if the service has one) NRS head. */ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) + const char __user *buffer, + size_t count, loff_t *off) { struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private; - enum ptlrpc_nrs_queue_type queue = PTLRPC_NRS_QUEUE_BOTH; - char *cmd; - char *cmd_copy = NULL; - char *token; - int rc = 0; + enum ptlrpc_nrs_queue_type queue = PTLRPC_NRS_QUEUE_BOTH; + char *cmd; + char *cmd_copy = NULL; + char *token; + int rc = 0; if (count >= LPROCFS_NRS_WR_MAX_CMD) return -EINVAL; @@ -729,8 +729,8 @@ ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service_part *svcpt, struct ptlrpc_srh_iterator *srhi, __u64 seq) { - struct list_head *e; - struct ptlrpc_request *req; + struct list_head *e; + struct ptlrpc_request *req; if (srhi->srhi_req != NULL && srhi->srhi_seq > svcpt->scp_hist_seq_culled && @@ -860,12 +860,12 @@ static void * ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s, void *iter, loff_t *pos) { - struct ptlrpc_service *svc = s->private; - struct ptlrpc_srh_iterator *srhi = iter; - struct ptlrpc_service_part *svcpt; - __u64 seq; - int rc; - int i; + struct ptlrpc_service *svc = s->private; + struct ptlrpc_srh_iterator *srhi = iter; + struct ptlrpc_service_part *svcpt; + __u64 seq; + int rc; + int i; for (i = srhi->srhi_idx; i < svc->srv_ncpts; i++) { svcpt = svc->srv_parts[i]; @@ -923,11 +923,11 @@ EXPORT_SYMBOL(target_print_req); static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) { - struct ptlrpc_service *svc = s->private; - struct ptlrpc_srh_iterator *srhi = iter; - struct ptlrpc_service_part *svcpt; - struct ptlrpc_request *req; - int rc; + struct ptlrpc_service *svc = s->private; + struct ptlrpc_srh_iterator *srhi = iter; + struct ptlrpc_service_part *svcpt; + struct ptlrpc_request *req; + int rc; LASSERT(srhi->srhi_idx < svc->srv_ncpts); @@ -972,8 +972,8 @@ ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file) .next = ptlrpc_lprocfs_svc_req_history_next, .show = ptlrpc_lprocfs_svc_req_history_show, }; - struct seq_file *seqf; - int rc; + struct seq_file *seqf; + int rc; rc = seq_open(file, &sops); if (rc) @@ -987,13 +987,13 @@ ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file) /* See also lprocfs_rd_timeouts */ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n) { - struct ptlrpc_service *svc = m->private; - struct ptlrpc_service_part *svcpt; - struct dhms ts; - time_t worstt; - unsigned int cur; - unsigned int worst; - int i; + struct ptlrpc_service *svc = m->private; + struct ptlrpc_service_part *svcpt; + struct dhms ts; + time_t worstt; + unsigned int cur; + unsigned int worst; + int i; if (AT_OFF) { seq_printf(m, "adaptive timeouts off, using obd_timeout %u\n", @@ -1215,8 +1215,8 @@ int lprocfs_wr_evict_client(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct obd_device *obd = ((struct seq_file *)file->private_data)->private; - char *kbuf; - char *tmpbuf; + char *kbuf; + char *tmpbuf; kbuf = kzalloc(BUFLEN, GFP_NOFS); if (kbuf == NULL) @@ -1264,7 +1264,7 @@ int lprocfs_wr_ping(struct file *file, const char __user *buffer, { struct obd_device *obd = ((struct seq_file *)file->private_data)->private; struct ptlrpc_request *req; - int rc; + int rc; LPROCFS_CLIMP_CHECK(obd); req = ptlrpc_prep_ping(obd->u.cli.cl_import); diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 2fa2585..92c746b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -52,17 +52,17 @@ static int ptl_send_buf(lnet_handle_md_t *mdh, void *base, int len, struct ptlrpc_connection *conn, int portal, __u64 xid, unsigned int offset) { - int rc; - lnet_md_t md; + int rc; + lnet_md_t md; LASSERT(portal != 0); LASSERT(conn != NULL); CDEBUG(D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer)); - md.start = base; - md.length = len; + md.start = base; + md.length = len; md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1; - md.options = PTLRPC_MD_OPTIONS; - md.user_ptr = cbid; + md.options = PTLRPC_MD_OPTIONS; + md.user_ptr = cbid; md.eq_handle = ptlrpc_eq_h; if (unlikely(ack == LNET_ACK_REQ && @@ -120,8 +120,8 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req) int posted_md; int total_md; __u64 xid; - lnet_handle_me_t me_h; - lnet_md_t md; + lnet_handle_me_t me_h; + lnet_md_t md; if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_GET_NET)) return 0; @@ -243,9 +243,9 @@ EXPORT_SYMBOL(ptlrpc_register_bulk); int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) { struct ptlrpc_bulk_desc *desc = req->rq_bulk; - wait_queue_head_t *wq; - struct l_wait_info lwi; - int rc; + wait_queue_head_t *wq; + struct l_wait_info lwi; + int rc; LASSERT(!in_interrupt()); /* might sleep */ @@ -301,8 +301,8 @@ EXPORT_SYMBOL(ptlrpc_unregister_bulk); static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) { - struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; - struct ptlrpc_service *svc = svcpt->scp_service; + struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; + struct ptlrpc_service *svc = svcpt->scp_service; int service_time = max_t(int, get_seconds() - req->rq_arrival_time.tv_sec, 1); @@ -353,8 +353,8 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) { struct ptlrpc_reply_state *rs = req->rq_reply_state; - struct ptlrpc_connection *conn; - int rc; + struct ptlrpc_connection *conn; + int rc; /* We must already have a reply buffer (only ptlrpc_error() may be * called without one). The reply generated by sptlrpc layer (e.g. @@ -491,8 +491,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) int rc2; int mpflag = 0; struct ptlrpc_connection *connection; - lnet_handle_me_t reply_me_h; - lnet_md_t reply_md; + lnet_handle_me_t reply_me_h; + lnet_md_t reply_md; struct obd_device *obd = request->rq_import->imp_obd; if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DROP_RPC)) @@ -594,15 +594,15 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) spin_unlock(&request->rq_lock); if (!noreply) { - reply_md.start = request->rq_repbuf; - reply_md.length = request->rq_repbuf_len; + reply_md.start = request->rq_repbuf; + reply_md.length = request->rq_repbuf_len; /* Allow multiple early replies */ reply_md.threshold = LNET_MD_THRESH_INF; /* Manage remote for early replies */ - reply_md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | + reply_md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MANAGE_REMOTE | LNET_MD_TRUNCATE; /* allow to make EOVERFLOW error */; - reply_md.user_ptr = &request->rq_reply_cbid; + reply_md.user_ptr = &request->rq_reply_cbid; reply_md.eq_handle = ptlrpc_eq_h; /* We must see the unlink callback to unset rq_reply_unlink, @@ -682,11 +682,11 @@ EXPORT_SYMBOL(ptl_send_rpc); */ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) { - struct ptlrpc_service *service = rqbd->rqbd_svcpt->scp_service; - static lnet_process_id_t match_id = {LNET_NID_ANY, LNET_PID_ANY}; - int rc; - lnet_md_t md; - lnet_handle_me_t me_h; + struct ptlrpc_service *service = rqbd->rqbd_svcpt->scp_service; + static lnet_process_id_t match_id = {LNET_NID_ANY, LNET_PID_ANY}; + int rc; + lnet_md_t md; + lnet_handle_me_t me_h; CDEBUG(D_NET, "LNetMEAttach: portal %d\n", service->srv_req_portal); @@ -709,12 +709,12 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) LASSERT(rqbd->rqbd_refcount == 0); rqbd->rqbd_refcount = 1; - md.start = rqbd->rqbd_buffer; - md.length = service->srv_buf_size; - md.max_size = service->srv_max_req_size; + md.start = rqbd->rqbd_buffer; + md.length = service->srv_buf_size; + md.max_size = service->srv_max_req_size; md.threshold = LNET_MD_THRESH_INF; - md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MAX_SIZE; - md.user_ptr = &rqbd->rqbd_cbid; + md.options = PTLRPC_MD_OPTIONS | LNET_MD_OP_PUT | LNET_MD_MAX_SIZE; + md.user_ptr = &rqbd->rqbd_cbid; md.eq_handle = ptlrpc_eq_h; rc = LNetMDAttach(me_h, md, LNET_UNLINK, &rqbd->rqbd_md_h); diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index d38a1af..9516aca 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -188,8 +188,8 @@ static void nrs_policy_stop_primary(struct ptlrpc_nrs *nrs) */ static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy) { - struct ptlrpc_nrs *nrs = policy->pol_nrs; - int rc = 0; + struct ptlrpc_nrs *nrs = policy->pol_nrs; + int rc = 0; /** * Don't allow multiple starting which is too complex, and has no real @@ -377,15 +377,15 @@ static void nrs_resource_put(struct ptlrpc_nrs_resource *res) */ static struct ptlrpc_nrs_resource *nrs_resource_get(struct ptlrpc_nrs_policy *policy, - struct ptlrpc_nrs_request *nrq, - bool moving_req) + struct ptlrpc_nrs_request *nrq, + bool moving_req) { /** * Set to NULL to traverse the resource hierarchy from the top. */ struct ptlrpc_nrs_resource *res = NULL; struct ptlrpc_nrs_resource *tmp = NULL; - int rc; + int rc; while (1) { rc = policy->pol_desc->pd_ops->op_res_get(policy, nrq, res, @@ -432,8 +432,8 @@ static void nrs_resource_get_safe(struct ptlrpc_nrs *nrs, struct ptlrpc_nrs_resource **resp, bool moving_req) { - struct ptlrpc_nrs_policy *primary = NULL; - struct ptlrpc_nrs_policy *fallback = NULL; + struct ptlrpc_nrs_policy *primary = NULL; + struct ptlrpc_nrs_policy *fallback = NULL; memset(resp, 0, sizeof(resp[0]) * NRS_RES_MAX); @@ -484,8 +484,8 @@ static void nrs_resource_get_safe(struct ptlrpc_nrs *nrs, static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp) { struct ptlrpc_nrs_policy *pols[NRS_RES_MAX]; - struct ptlrpc_nrs *nrs = NULL; - int i; + struct ptlrpc_nrs *nrs = NULL; + int i; for (i = 0; i < NRS_RES_MAX; i++) { if (resp[i] != NULL) { @@ -530,7 +530,7 @@ static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp) */ static inline struct ptlrpc_nrs_request *nrs_request_get(struct ptlrpc_nrs_policy *policy, - bool peek, bool force) + bool peek, bool force) { struct ptlrpc_nrs_request *nrq; @@ -556,8 +556,8 @@ struct ptlrpc_nrs_request *nrs_request_get(struct ptlrpc_nrs_policy *policy, static inline void nrs_request_enqueue(struct ptlrpc_nrs_request *nrq) { struct ptlrpc_nrs_policy *policy; - int rc; - int i; + int rc; + int i; /** * Try in descending order, because the primary policy (if any) is @@ -628,8 +628,8 @@ static inline void nrs_request_stop(struct ptlrpc_nrs_request *nrq) static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name, enum ptlrpc_nrs_ctl opc, void *arg) { - struct ptlrpc_nrs_policy *policy; - int rc = 0; + struct ptlrpc_nrs_policy *policy; + int rc = 0; spin_lock(&nrs->nrs_lock); @@ -733,10 +733,10 @@ static int nrs_policy_unregister(struct ptlrpc_nrs *nrs, char *name) static int nrs_policy_register(struct ptlrpc_nrs *nrs, struct ptlrpc_nrs_pol_desc *desc) { - struct ptlrpc_nrs_policy *policy; - struct ptlrpc_nrs_policy *tmp; - struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt; - int rc; + struct ptlrpc_nrs_policy *policy; + struct ptlrpc_nrs_policy *tmp; + struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt; + int rc; LASSERT(svcpt != NULL); LASSERT(desc->pd_ops != NULL); @@ -752,10 +752,10 @@ static int nrs_policy_register(struct ptlrpc_nrs *nrs, if (policy == NULL) return -ENOMEM; - policy->pol_nrs = nrs; - policy->pol_desc = desc; - policy->pol_state = NRS_POL_STATE_STOPPED; - policy->pol_flags = desc->pd_flags; + policy->pol_nrs = nrs; + policy->pol_desc = desc; + policy->pol_state = NRS_POL_STATE_STOPPED; + policy->pol_flags = desc->pd_flags; INIT_LIST_HEAD(&policy->pol_list); INIT_LIST_HEAD(&policy->pol_list_queued); @@ -804,7 +804,7 @@ static int nrs_policy_register(struct ptlrpc_nrs *nrs, */ static void ptlrpc_nrs_req_add_nolock(struct ptlrpc_request *req) { - struct ptlrpc_nrs_policy *policy; + struct ptlrpc_nrs_policy *policy; LASSERT(req->rq_nrq.nr_initialized); LASSERT(!req->rq_nrq.nr_enqueued); @@ -829,7 +829,7 @@ static void ptlrpc_nrs_req_add_nolock(struct ptlrpc_request *req) */ static void ptlrpc_nrs_hpreq_add_nolock(struct ptlrpc_request *req) { - int opc = lustre_msg_get_opc(req->rq_reqmsg); + int opc = lustre_msg_get_opc(req->rq_reqmsg); spin_lock(&req->rq_lock); req->rq_hp = 1; @@ -872,9 +872,9 @@ static int nrs_register_policies_locked(struct ptlrpc_nrs *nrs) { struct ptlrpc_nrs_pol_desc *desc; /* for convenience */ - struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt; - struct ptlrpc_service *svc = svcpt->scp_service; - int rc = -EINVAL; + struct ptlrpc_service_part *svcpt = nrs->nrs_svcpt; + struct ptlrpc_service *svc = svcpt->scp_service; + int rc = -EINVAL; LASSERT(mutex_is_locked(&nrs_core.nrs_mutex)); @@ -912,7 +912,7 @@ static int nrs_register_policies_locked(struct ptlrpc_nrs *nrs) static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs, struct ptlrpc_service_part *svcpt) { - enum ptlrpc_nrs_queue_type queue; + enum ptlrpc_nrs_queue_type queue; LASSERT(mutex_is_locked(&nrs_core.nrs_mutex)); @@ -943,8 +943,8 @@ static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs, */ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) { - struct ptlrpc_nrs *nrs; - int rc; + struct ptlrpc_nrs *nrs; + int rc; LASSERT(mutex_is_locked(&nrs_core.nrs_mutex)); @@ -988,11 +988,11 @@ out: */ static void nrs_svcpt_cleanup_locked(struct ptlrpc_service_part *svcpt) { - struct ptlrpc_nrs *nrs; - struct ptlrpc_nrs_policy *policy; - struct ptlrpc_nrs_policy *tmp; - int rc; - bool hp = false; + struct ptlrpc_nrs *nrs; + struct ptlrpc_nrs_policy *policy; + struct ptlrpc_nrs_policy *tmp; + int rc; + bool hp = false; LASSERT(mutex_is_locked(&nrs_core.nrs_mutex)); @@ -1028,7 +1028,7 @@ again: */ static struct ptlrpc_nrs_pol_desc *nrs_policy_find_desc_locked(const char *name) { - struct ptlrpc_nrs_pol_desc *tmp; + struct ptlrpc_nrs_pol_desc *tmp; list_for_each_entry(tmp, &nrs_core.nrs_policies, pd_list) { if (strncmp(tmp->pd_name, name, NRS_POL_NAME_MAX) == 0) @@ -1051,11 +1051,11 @@ static struct ptlrpc_nrs_pol_desc *nrs_policy_find_desc_locked(const char *name) */ static int nrs_policy_unregister_locked(struct ptlrpc_nrs_pol_desc *desc) { - struct ptlrpc_nrs *nrs; - struct ptlrpc_service *svc; - struct ptlrpc_service_part *svcpt; - int i; - int rc = 0; + struct ptlrpc_nrs *nrs; + struct ptlrpc_service *svc; + struct ptlrpc_service_part *svcpt; + int i; + int rc = 0; LASSERT(mutex_is_locked(&nrs_core.nrs_mutex)); LASSERT(mutex_is_locked(&ptlrpc_all_services_mutex)); @@ -1115,9 +1115,9 @@ again: */ int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf) { - struct ptlrpc_service *svc; - struct ptlrpc_nrs_pol_desc *desc; - int rc = 0; + struct ptlrpc_service *svc; + struct ptlrpc_nrs_pol_desc *desc; + int rc = 0; LASSERT(conf != NULL); LASSERT(conf->nc_ops != NULL); @@ -1162,12 +1162,12 @@ int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf) } strncpy(desc->pd_name, conf->nc_name, NRS_POL_NAME_MAX); - desc->pd_ops = conf->nc_ops; - desc->pd_compat = conf->nc_compat; + desc->pd_ops = conf->nc_ops; + desc->pd_compat = conf->nc_compat; desc->pd_compat_svc_name = conf->nc_compat_svc_name; if ((conf->nc_flags & PTLRPC_NRS_FL_REG_EXTERN) != 0) - desc->pd_owner = conf->nc_owner; - desc->pd_flags = conf->nc_flags; + desc->pd_owner = conf->nc_owner; + desc->pd_flags = conf->nc_flags; atomic_set(&desc->pd_refs, 0); /** @@ -1187,17 +1187,17 @@ int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf) mutex_lock(&ptlrpc_all_services_mutex); list_for_each_entry(svc, &ptlrpc_all_services, srv_list) { - struct ptlrpc_service_part *svcpt; - int i; - int rc2; + struct ptlrpc_service_part *svcpt; + int i; + int rc2; if (!nrs_policy_compatible(svc, desc) || unlikely(svc->srv_is_stopping)) continue; ptlrpc_service_for_each_part(svcpt, i, svc) { - struct ptlrpc_nrs *nrs; - bool hp = false; + struct ptlrpc_nrs *nrs; + bool hp = false; again: nrs = nrs_svcpt2nrs(svcpt, hp); rc = nrs_policy_register(nrs, desc); @@ -1267,8 +1267,8 @@ EXPORT_SYMBOL(ptlrpc_nrs_policy_register); */ int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf) { - struct ptlrpc_nrs_pol_desc *desc; - int rc; + struct ptlrpc_nrs_pol_desc *desc; + int rc; LASSERT(conf != NULL); @@ -1331,10 +1331,10 @@ EXPORT_SYMBOL(ptlrpc_nrs_policy_unregister); */ int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc) { - struct ptlrpc_service_part *svcpt; - const struct ptlrpc_nrs_pol_desc *desc; - int i; - int rc = 0; + struct ptlrpc_service_part *svcpt; + const struct ptlrpc_nrs_pol_desc *desc; + int i; + int rc = 0; mutex_lock(&nrs_core.nrs_mutex); @@ -1376,9 +1376,9 @@ failed: */ void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc) { - struct ptlrpc_service_part *svcpt; - const struct ptlrpc_nrs_pol_desc *desc; - int i; + struct ptlrpc_service_part *svcpt; + const struct ptlrpc_nrs_pol_desc *desc; + int i; mutex_lock(&nrs_core.nrs_mutex); @@ -1417,7 +1417,7 @@ void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc) void ptlrpc_nrs_req_initialize(struct ptlrpc_service_part *svcpt, struct ptlrpc_request *req, bool hp) { - struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp); + struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp); memset(&req->rq_nrq, 0, sizeof(req->rq_nrq)); nrs_resource_get_safe(nrs, &req->rq_nrq, req->rq_nrq.nr_res_ptrs, @@ -1525,8 +1525,8 @@ struct ptlrpc_request * ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, bool peek, bool force) { - struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp); - struct ptlrpc_nrs_policy *policy; + struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp); + struct ptlrpc_nrs_policy *policy; struct ptlrpc_nrs_request *nrq; /** @@ -1596,10 +1596,10 @@ bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp) */ void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req) { - struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; - struct ptlrpc_nrs_request *nrq = &req->rq_nrq; - struct ptlrpc_nrs_resource *res1[NRS_RES_MAX]; - struct ptlrpc_nrs_resource *res2[NRS_RES_MAX]; + struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; + struct ptlrpc_nrs_request *nrq = &req->rq_nrq; + struct ptlrpc_nrs_resource *res1[NRS_RES_MAX]; + struct ptlrpc_nrs_resource *res2[NRS_RES_MAX]; /** * Obtain the high-priority NRS head resources. @@ -1661,9 +1661,9 @@ int ptlrpc_nrs_policy_control(const struct ptlrpc_service *svc, enum ptlrpc_nrs_queue_type queue, char *name, enum ptlrpc_nrs_ctl opc, bool single, void *arg) { - struct ptlrpc_service_part *svcpt; - int i; - int rc = 0; + struct ptlrpc_service_part *svcpt; + int i; + int rc = 0; LASSERT(opc != PTLRPC_NRS_CTL_INVALID); @@ -1711,7 +1711,7 @@ extern struct ptlrpc_nrs_pol_conf nrs_conf_fifo; */ int ptlrpc_nrs_init(void) { - int rc; + int rc; mutex_init(&nrs_core.nrs_mutex); INIT_LIST_HEAD(&nrs_core.nrs_policies); diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c index 6a61c85..8e21f0c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c @@ -160,9 +160,9 @@ static int nrs_fifo_res_get(struct ptlrpc_nrs_policy *policy, */ static struct ptlrpc_nrs_request *nrs_fifo_req_get(struct ptlrpc_nrs_policy *policy, - bool peek, bool force) + bool peek, bool force) { - struct nrs_fifo_head *head = policy->pol_private; + struct nrs_fifo_head *head = policy->pol_private; struct ptlrpc_nrs_request *nrq; nrq = unlikely(list_empty(&head->fh_list)) ? NULL : diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index b51af9b..2787bfd 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -279,8 +279,8 @@ lustre_get_emerg_rs(struct ptlrpc_service_part *svcpt) /* See if we have anything in a pool, and wait if nothing */ while (list_empty(&svcpt->scp_rep_idle)) { - struct l_wait_info lwi; - int rc; + struct l_wait_info lwi; + int rc; spin_unlock(&svcpt->scp_rep_lock); /* If we cannot get anything for some long time, we better @@ -321,7 +321,7 @@ int lustre_pack_reply_v2(struct ptlrpc_request *req, int count, __u32 *lens, char **bufs, int flags) { struct ptlrpc_reply_state *rs; - int msg_len, rc; + int msg_len, rc; LASSERT(req->rq_reply_state == NULL); @@ -440,8 +440,8 @@ EXPORT_SYMBOL(lustre_msg_buf); int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment, unsigned int newlen, int move_data) { - char *tail = NULL, *newpos; - int tail_len = 0, n; + char *tail = NULL, *newpos; + int tail_len = 0, n; LASSERT(msg); LASSERT(msg->lm_bufcount > segment); @@ -1577,8 +1577,8 @@ int do_set_info_async(struct obd_import *imp, struct ptlrpc_request_set *set) { struct ptlrpc_request *req; - char *tmp; - int rc; + char *tmp; + int rc; req = ptlrpc_request_alloc(imp, &RQF_OBD_SET_INFO); if (req == NULL) @@ -1688,7 +1688,7 @@ void lustre_swab_connect(struct obd_connect_data *ocd) CLASSERT(offsetof(typeof(*ocd), paddingF) != 0); } -void lustre_swab_obdo(struct obdo *o) +void lustre_swab_obdo(struct obdo *o) { __swab64s(&o->o_valid); lustre_swab_ost_id(&o->o_oi); @@ -2179,7 +2179,7 @@ EXPORT_SYMBOL(lustre_swab_lov_user_md_objects); void lustre_swab_ldlm_res_id(struct ldlm_res_id *id) { - int i; + int i; for (i = 0; i < RES_NAME_SIZE; i++) __swab64s(&id->name[i]); diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 9fc8156..61e33be 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -546,8 +546,8 @@ void ptlrpc_pinger_wake_up(void) #define PET_TERMINATE 2 static int pet_refcount; -static int pet_state; -static wait_queue_head_t pet_waitq; +static int pet_state; +static wait_queue_head_t pet_waitq; static LIST_HEAD(pet_list); static DEFINE_SPINLOCK(pet_lock); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 5ba3e6e..e591cff 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -68,9 +68,9 @@ #include "ptlrpc_internal.h" struct ptlrpcd { - int pd_size; - int pd_index; - int pd_nthreads; + int pd_size; + int pd_index; + int pd_nthreads; struct ptlrpcd_ctl pd_thread_rcv; struct ptlrpcd_ctl pd_threads[0]; }; diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index bcfd0b0..8798fab 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -113,10 +113,10 @@ static struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(__u32 flavor) { static DEFINE_MUTEX(load_mutex); - static atomic_t loaded = ATOMIC_INIT(0); + static atomic_t loaded = ATOMIC_INIT(0); struct ptlrpc_sec_policy *policy; - __u16 number = SPTLRPC_FLVR_POLICY(flavor); - __u16 flag = 0; + __u16 number = SPTLRPC_FLVR_POLICY(flavor); + __u16 flag = 0; if (number >= SPTLRPC_POLICY_MAX) return NULL; @@ -339,7 +339,7 @@ int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize) static int import_sec_check_expire(struct obd_import *imp) { - int adapt = 0; + int adapt = 0; spin_lock(&imp->imp_lock); if (imp->imp_sec_expire && @@ -359,7 +359,7 @@ static int import_sec_check_expire(struct obd_import *imp) static int import_sec_validate_get(struct obd_import *imp, struct ptlrpc_sec **sec) { - int rc; + int rc; if (unlikely(imp->imp_sec_expire)) { rc = import_sec_check_expire(imp); @@ -447,10 +447,10 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req, struct ptlrpc_cli_ctx *oldctx, struct ptlrpc_cli_ctx *newctx) { - struct sptlrpc_flavor old_flvr; - char *reqmsg = NULL; /* to workaround old gcc */ - int reqmsg_size; - int rc = 0; + struct sptlrpc_flavor old_flvr; + char *reqmsg = NULL; /* to workaround old gcc */ + int reqmsg_size; + int rc = 0; LASSERT(req->rq_reqmsg); LASSERT(req->rq_reqlen); @@ -514,7 +514,7 @@ int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req) { struct ptlrpc_cli_ctx *oldctx = req->rq_cli_ctx; struct ptlrpc_cli_ctx *newctx; - int rc; + int rc; LASSERT(oldctx); @@ -629,10 +629,10 @@ void req_off_ctx_list(struct ptlrpc_request *req, struct ptlrpc_cli_ctx *ctx) */ int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout) { - struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx; - struct ptlrpc_sec *sec; - struct l_wait_info lwi; - int rc; + struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx; + struct ptlrpc_sec *sec; + struct l_wait_info lwi; + int rc; LASSERT(ctx); @@ -878,7 +878,7 @@ void sptlrpc_request_out_callback(struct ptlrpc_request *req) */ int sptlrpc_import_check_ctx(struct obd_import *imp) { - struct ptlrpc_sec *sec; + struct ptlrpc_sec *sec; struct ptlrpc_cli_ctx *ctx; struct ptlrpc_request *req = NULL; int rc; @@ -974,7 +974,7 @@ int sptlrpc_cli_wrap_request(struct ptlrpc_request *req) static int do_cli_unwrap_reply(struct ptlrpc_request *req) { struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx; - int rc; + int rc; LASSERT(ctx); LASSERT(ctx->cc_sec); @@ -1082,10 +1082,10 @@ int sptlrpc_cli_unwrap_reply(struct ptlrpc_request *req) int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, struct ptlrpc_request **req_ret) { - struct ptlrpc_request *early_req; - char *early_buf; - int early_bufsz, early_size; - int rc; + struct ptlrpc_request *early_req; + char *early_buf; + int early_bufsz, early_size; + int rc; early_req = ptlrpc_request_cache_alloc(GFP_NOFS); if (early_req == NULL) @@ -1273,13 +1273,13 @@ EXPORT_SYMBOL(sptlrpc_sec_put); */ static struct ptlrpc_sec *sptlrpc_sec_create(struct obd_import *imp, - struct ptlrpc_svc_ctx *svc_ctx, - struct sptlrpc_flavor *sf, - enum lustre_sec_part sp) + struct ptlrpc_svc_ctx *svc_ctx, + struct sptlrpc_flavor *sf, + enum lustre_sec_part sp) { struct ptlrpc_sec_policy *policy; - struct ptlrpc_sec *sec; - char str[32]; + struct ptlrpc_sec *sec; + char str[32]; if (svc_ctx) { LASSERT(imp->imp_dlm_fake == 1); @@ -1369,7 +1369,7 @@ static void sptlrpc_import_sec_adapt_inplace(struct obd_import *imp, struct ptlrpc_sec *sec, struct sptlrpc_flavor *sf) { - char str1[32], str2[32]; + char str1[32], str2[32]; if (sec->ps_flvr.sf_flags != sf->sf_flags) CDEBUG(D_SEC, "changing sec flags: %s -> %s\n", @@ -1394,12 +1394,12 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp, struct ptlrpc_svc_ctx *svc_ctx, struct sptlrpc_flavor *flvr) { - struct ptlrpc_connection *conn; - struct sptlrpc_flavor sf; - struct ptlrpc_sec *sec, *newsec; - enum lustre_sec_part sp; - char str[24]; - int rc = 0; + struct ptlrpc_connection *conn; + struct sptlrpc_flavor sf; + struct ptlrpc_sec *sec, *newsec; + enum lustre_sec_part sp; + char str[24]; + int rc = 0; might_sleep(); @@ -1436,7 +1436,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp, sec = sptlrpc_import_sec_ref(imp); if (sec) { - char str2[24]; + char str2[24]; if (flavor_equal(&sf, &sec->ps_flvr)) goto out; @@ -1585,8 +1585,8 @@ void sptlrpc_cli_free_reqbuf(struct ptlrpc_request *req) void _sptlrpc_enlarge_msg_inplace(struct lustre_msg *msg, int segment, int newsize) { - void *src, *dst; - int oldsize, oldmsg_size, movesize; + void *src, *dst; + int oldsize, oldmsg_size, movesize; LASSERT(segment < msg->lm_bufcount); LASSERT(msg->lm_buflens[segment] <= newsize); @@ -1635,9 +1635,9 @@ EXPORT_SYMBOL(_sptlrpc_enlarge_msg_inplace); int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req, int segment, int newsize) { - struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx; - struct ptlrpc_sec_cops *cops; - struct lustre_msg *msg = req->rq_reqmsg; + struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx; + struct ptlrpc_sec_cops *cops; + struct lustre_msg *msg = req->rq_reqmsg; LASSERT(ctx); LASSERT(msg); @@ -1748,7 +1748,7 @@ static int flavor_allowed(struct sptlrpc_flavor *exp, int sptlrpc_target_export_check(struct obd_export *exp, struct ptlrpc_request *req) { - struct sptlrpc_flavor flavor; + struct sptlrpc_flavor flavor; if (exp == NULL) return 0; @@ -1926,8 +1926,8 @@ EXPORT_SYMBOL(sptlrpc_target_export_check); void sptlrpc_target_update_exp_flavor(struct obd_device *obd, struct sptlrpc_rule_set *rset) { - struct obd_export *exp; - struct sptlrpc_flavor new_flvr; + struct obd_export *exp; + struct sptlrpc_flavor new_flvr; LASSERT(obd); @@ -2019,8 +2019,8 @@ static int sptlrpc_svc_check_from(struct ptlrpc_request *req, int svc_rc) int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req) { struct ptlrpc_sec_policy *policy; - struct lustre_msg *msg = req->rq_reqbuf; - int rc; + struct lustre_msg *msg = req->rq_reqbuf; + int rc; LASSERT(msg); LASSERT(req->rq_reqmsg == NULL); @@ -2231,8 +2231,8 @@ int sptlrpc_cli_unwrap_bulk_read(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc, int nob) { - struct ptlrpc_cli_ctx *ctx; - int rc; + struct ptlrpc_cli_ctx *ctx; + int rc; LASSERT(req->rq_bulk_read && !req->rq_bulk_write); @@ -2256,8 +2256,8 @@ EXPORT_SYMBOL(sptlrpc_cli_unwrap_bulk_read); int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc) { - struct ptlrpc_cli_ctx *ctx; - int rc; + struct ptlrpc_cli_ctx *ctx; + int rc; LASSERT(!req->rq_bulk_read && req->rq_bulk_write); @@ -2329,7 +2329,7 @@ EXPORT_SYMBOL(sptlrpc_pack_user_desc); int sptlrpc_unpack_user_desc(struct lustre_msg *msg, int offset, int swabbed) { struct ptlrpc_user_desc *pud; - int i; + int i; pud = lustre_msg_buf(msg, offset, sizeof(*pud)); if (!pud) diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 97edc91..ea35ca5 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -62,7 +62,7 @@ #define POINTERS_PER_PAGE (PAGE_CACHE_SIZE / sizeof(void *)) #define PAGES_PER_POOL (POINTERS_PER_PAGE) -#define IDLE_IDX_MAX (100) +#define IDLE_IDX_MAX (100) #define IDLE_IDX_WEIGHT (3) #define CACHE_QUIESCENT_PERIOD (20) @@ -173,8 +173,8 @@ int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v) static void enc_pools_release_free_pages(long npages) { - int p_idx, g_idx; - int p_idx_max1, p_idx_max2; + int p_idx, g_idx; + int p_idx_max1, p_idx_max2; LASSERT(npages > 0); LASSERT(npages <= page_pools.epp_free_pages); @@ -284,7 +284,7 @@ int npages_to_npools(unsigned long npages) static unsigned long enc_pools_cleanup(struct page ***pools, int npools) { unsigned long cleaned = 0; - int i, j; + int i, j; for (i = 0; i < npools; i++) { if (pools[i]) { @@ -311,9 +311,9 @@ static unsigned long enc_pools_cleanup(struct page ***pools, int npools) */ static void enc_pools_insert(struct page ***pools, int npools, int npages) { - int freeslot; - int op_idx, np_idx, og_idx, ng_idx; - int cur_npools, end_npools; + int freeslot; + int op_idx, np_idx, og_idx, ng_idx; + int cur_npools, end_npools; LASSERT(npages > 0); LASSERT(page_pools.epp_total_pages+npages <= page_pools.epp_max_pages); @@ -393,9 +393,9 @@ static void enc_pools_insert(struct page ***pools, int npools, int npages) static int enc_pools_add_pages(int npages) { static DEFINE_MUTEX(add_pages_mutex); - struct page ***pools; - int npools, alloced = 0; - int i, j, rc = -ENOMEM; + struct page ***pools; + int npools, alloced = 0; + int i, j, rc = -ENOMEM; if (npages < PTLRPC_MAX_BRW_PAGES) npages = PTLRPC_MAX_BRW_PAGES; @@ -494,12 +494,12 @@ static int enc_pools_should_grow(int page_needed, long now) */ int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc) { - wait_queue_t waitlink; - unsigned long this_idle = -1; - unsigned long tick = 0; - long now; - int p_idx, g_idx; - int i; + wait_queue_t waitlink; + unsigned long this_idle = -1; + unsigned long tick = 0; + long now; + int p_idx, g_idx; + int i; LASSERT(desc->bd_iov_count > 0); LASSERT(desc->bd_iov_count <= page_pools.epp_max_pages); @@ -609,8 +609,8 @@ EXPORT_SYMBOL(sptlrpc_enc_pool_get_pages); void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc) { - int p_idx, g_idx; - int i; + int p_idx, g_idx; + int i; if (desc->bd_enc_iov == NULL) return; @@ -658,7 +658,7 @@ EXPORT_SYMBOL(sptlrpc_enc_pool_put_pages); */ int sptlrpc_enc_pool_add_user(void) { - int need_grow = 0; + int need_grow = 0; spin_lock(&page_pools.epp_lock); if (page_pools.epp_growing == 0 && page_pools.epp_total_pages == 0) { @@ -842,11 +842,11 @@ EXPORT_SYMBOL(bulk_sec_desc_unpack); int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg, void *buf, int buflen) { - struct cfs_crypto_hash_desc *hdesc; - int hashsize; - char hashbuf[64]; - unsigned int bufsize; - int i, err; + struct cfs_crypto_hash_desc *hdesc; + int hashsize; + char hashbuf[64]; + unsigned int bufsize; + int i, err; LASSERT(alg > BULK_HASH_ALG_NULL && alg < BULK_HASH_ALG_MAX); LASSERT(buflen >= 4); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c index 16dbf3f..31da43e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c @@ -94,8 +94,8 @@ EXPORT_SYMBOL(sptlrpc_target_sec_part); */ int sptlrpc_parse_flavor(const char *str, struct sptlrpc_flavor *flvr) { - char buf[32]; - char *bulk, *alg; + char buf[32]; + char *bulk, *alg; memset(flvr, 0, sizeof(*flvr)); @@ -182,8 +182,8 @@ static void sptlrpc_rule_init(struct sptlrpc_rule *rule) */ int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule) { - char *flavor, *dir; - int rc; + char *flavor, *dir; + int rc; sptlrpc_rule_init(rule); @@ -309,9 +309,9 @@ static inline int rule_match_net(struct sptlrpc_rule *r1, int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset, struct sptlrpc_rule *rule) { - struct sptlrpc_rule *p = rset->srs_rules; - int spec_dir, spec_net; - int rc, n, match = 0; + struct sptlrpc_rule *p = rset->srs_rules; + int spec_dir, spec_net; + int rc, n, match = 0; might_sleep(); @@ -403,8 +403,8 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset, lnet_nid_t nid, struct sptlrpc_flavor *sf) { - struct sptlrpc_rule *r; - int n; + struct sptlrpc_rule *r; + int n; for (n = 0; n < rset->srs_nrule; n++) { r = &rset->srs_rules[n]; @@ -433,7 +433,7 @@ EXPORT_SYMBOL(sptlrpc_rule_set_choose); void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset) { struct sptlrpc_rule *r; - int n; + int n; for (n = 0; n < rset->srs_nrule; n++) { r = &rset->srs_rules[n]; @@ -474,8 +474,8 @@ static inline int is_hex(char c) static void target2fsname(const char *tgt, char *fsname, int buflen) { - const char *ptr; - int len; + const char *ptr; + int len; ptr = strrchr(tgt, '-'); if (ptr) { @@ -583,8 +583,8 @@ static int sptlrpc_conf_merge_rule(struct sptlrpc_conf *conf, const char *target, struct sptlrpc_rule *rule) { - struct sptlrpc_conf_tgt *conf_tgt; - struct sptlrpc_rule_set *rule_set; + struct sptlrpc_conf_tgt *conf_tgt; + struct sptlrpc_rule_set *rule_set; /* fsname == target means general rules for the whole fs */ if (strcmp(conf->sc_fsname, target) == 0) { @@ -610,10 +610,10 @@ static int sptlrpc_conf_merge_rule(struct sptlrpc_conf *conf, static int __sptlrpc_process_config(struct lustre_cfg *lcfg, struct sptlrpc_conf *conf) { - char *target, *param; - char fsname[MTI_NAME_MAXLEN]; - struct sptlrpc_rule rule; - int rc; + char *target, *param; + char fsname[MTI_NAME_MAXLEN]; + struct sptlrpc_rule rule; + int rc; target = lustre_cfg_string(lcfg, 1); if (target == NULL) { @@ -671,8 +671,8 @@ EXPORT_SYMBOL(sptlrpc_process_config); static int logname2fsname(const char *logname, char *buf, int buflen) { - char *ptr; - int len; + char *ptr; + int len; ptr = strrchr(logname, '-'); if (ptr == NULL || strcmp(ptr, "-sptlrpc")) { @@ -690,7 +690,7 @@ static int logname2fsname(const char *logname, char *buf, int buflen) void sptlrpc_conf_log_update_begin(const char *logname) { struct sptlrpc_conf *conf; - char fsname[16]; + char fsname[16]; if (logname2fsname(logname, fsname, sizeof(fsname))) return; @@ -716,7 +716,7 @@ EXPORT_SYMBOL(sptlrpc_conf_log_update_begin); void sptlrpc_conf_log_update_end(const char *logname) { struct sptlrpc_conf *conf; - char fsname[16]; + char fsname[16]; if (logname2fsname(logname, fsname, sizeof(fsname))) return; @@ -741,7 +741,7 @@ EXPORT_SYMBOL(sptlrpc_conf_log_update_end); void sptlrpc_conf_log_start(const char *logname) { - char fsname[16]; + char fsname[16]; if (logname2fsname(logname, fsname, sizeof(fsname))) return; @@ -755,7 +755,7 @@ EXPORT_SYMBOL(sptlrpc_conf_log_start); void sptlrpc_conf_log_stop(const char *logname) { struct sptlrpc_conf *conf; - char fsname[16]; + char fsname[16]; if (logname2fsname(logname, fsname, sizeof(fsname))) return; @@ -799,10 +799,10 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from, lnet_nid_t nid, struct sptlrpc_flavor *sf) { - struct sptlrpc_conf *conf; + struct sptlrpc_conf *conf; struct sptlrpc_conf_tgt *conf_tgt; - char name[MTI_NAME_MAXLEN]; - int len, rc = 0; + char name[MTI_NAME_MAXLEN]; + int len, rc = 0; target2fsname(target->uuid, name, sizeof(name)); @@ -858,7 +858,7 @@ EXPORT_SYMBOL(sptlrpc_target_choose_flavor); */ void sptlrpc_conf_client_adapt(struct obd_device *obd) { - struct obd_import *imp; + struct obd_import *imp; LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 || strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0); @@ -880,7 +880,7 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd) } EXPORT_SYMBOL(sptlrpc_conf_client_adapt); -int sptlrpc_conf_init(void) +int sptlrpc_conf_init(void) { mutex_init(&sptlrpc_conf_lock); return 0; @@ -888,7 +888,7 @@ int sptlrpc_conf_init(void) void sptlrpc_conf_fini(void) { - struct sptlrpc_conf *conf, *conf_next; + struct sptlrpc_conf *conf, *conf_next; mutex_lock(&sptlrpc_conf_lock); list_for_each_entry_safe(conf, conf_next, &sptlrpc_confs, sc_list) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c index 81de68e..cdad608 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c @@ -164,7 +164,7 @@ static void sec_do_gc(struct ptlrpc_sec *sec) static int sec_gc_main(void *arg) { struct ptlrpc_thread *thread = (struct ptlrpc_thread *) arg; - struct l_wait_info lwi; + struct l_wait_info lwi; unshare_fs_struct(); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c index 982512f..68fcac1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c @@ -74,7 +74,7 @@ static int sptlrpc_info_lprocfs_seq_show(struct seq_file *seq, void *v) struct obd_device *dev = seq->private; struct client_obd *cli = &dev->u.cli; struct ptlrpc_sec *sec = NULL; - char str[32]; + char str[32]; LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 || strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 || @@ -134,7 +134,7 @@ LPROC_SEQ_FOPS_RO(sptlrpc_ctxs_lprocfs); int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev) { - int rc; + int rc; if (strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 && strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 && diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c index 4e13243..8c28b6b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c @@ -92,7 +92,7 @@ int null_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) static int null_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) { - __u32 cksums, cksumc; + __u32 cksums, cksumc; LASSERT(req->rq_repdata); @@ -226,9 +226,9 @@ int null_enlarge_reqbuf(struct ptlrpc_sec *sec, struct ptlrpc_request *req, int segment, int newsize) { - struct lustre_msg *newbuf; - struct lustre_msg *oldbuf = req->rq_reqmsg; - int oldsize, newmsg_size, alloc_size; + struct lustre_msg *newbuf; + struct lustre_msg *oldbuf = req->rq_reqmsg; + int oldsize, newmsg_size, alloc_size; LASSERT(req->rq_reqbuf); LASSERT(req->rq_reqbuf == req->rq_reqmsg); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c index 65f3ab4..ed39970 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c @@ -136,7 +136,7 @@ static int plain_verify_bulk_csum(struct ptlrpc_bulk_desc *desc, struct plain_bulk_token *tokenr) { struct plain_bulk_token tokenv; - int rc; + int rc; if (hash_alg == BULK_HASH_ALG_NULL) return 0; @@ -154,8 +154,8 @@ static int plain_verify_bulk_csum(struct ptlrpc_bulk_desc *desc, static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc) { - char *ptr; - unsigned int off, i; + char *ptr; + unsigned int off, i; for (i = 0; i < desc->bd_iov_count; i++) { if (desc->bd_iov[i].kiov_len == 0) @@ -190,7 +190,7 @@ int plain_ctx_validate(struct ptlrpc_cli_ctx *ctx) static int plain_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) { - struct lustre_msg *msg = req->rq_reqbuf; + struct lustre_msg *msg = req->rq_reqbuf; struct plain_header *phdr; msg->lm_secflvr = req->rq_flvr.sf_rpc; @@ -214,10 +214,10 @@ int plain_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) static int plain_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) { - struct lustre_msg *msg = req->rq_repdata; + struct lustre_msg *msg = req->rq_repdata; struct plain_header *phdr; - __u32 cksum; - int swabbed; + __u32 cksum; + int swabbed; if (msg->lm_bufcount != PLAIN_PACK_SEGMENTS) { CERROR("unexpected reply buf count %u\n", msg->lm_bufcount); @@ -290,8 +290,8 @@ int plain_cli_wrap_bulk(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_bulk_desc *desc) { struct ptlrpc_bulk_sec_desc *bsd; - struct plain_bulk_token *token; - int rc; + struct plain_bulk_token *token; + int rc; LASSERT(req->rq_pack_bulk); LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS); @@ -333,9 +333,9 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_bulk_desc *desc) { struct ptlrpc_bulk_sec_desc *bsdv; - struct plain_bulk_token *tokenv; - int rc; - int i, nob; + struct plain_bulk_token *tokenv; + int rc; + int i, nob; LASSERT(req->rq_pack_bulk); LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS); @@ -374,7 +374,7 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, static struct ptlrpc_cli_ctx *plain_sec_install_ctx(struct plain_sec *plsec) { - struct ptlrpc_cli_ctx *ctx, *ctx_new; + struct ptlrpc_cli_ctx *ctx, *ctx_new; ctx_new = kzalloc(sizeof(*ctx_new), GFP_NOFS); @@ -413,7 +413,7 @@ struct ptlrpc_cli_ctx *plain_sec_install_ctx(struct plain_sec *plsec) static void plain_destroy_sec(struct ptlrpc_sec *sec) { - struct plain_sec *plsec = sec2plsec(sec); + struct plain_sec *plsec = sec2plsec(sec); LASSERT(sec->ps_policy == &plain_policy); LASSERT(sec->ps_import); @@ -437,9 +437,9 @@ struct ptlrpc_sec *plain_create_sec(struct obd_import *imp, struct ptlrpc_svc_ctx *svc_ctx, struct sptlrpc_flavor *sf) { - struct plain_sec *plsec; - struct ptlrpc_sec *sec; - struct ptlrpc_cli_ctx *ctx; + struct plain_sec *plsec; + struct ptlrpc_sec *sec; + struct ptlrpc_cli_ctx *ctx; LASSERT(SPTLRPC_FLVR_POLICY(sf->sf_rpc) == SPTLRPC_POLICY_PLAIN); @@ -483,8 +483,8 @@ struct ptlrpc_cli_ctx *plain_lookup_ctx(struct ptlrpc_sec *sec, struct vfs_cred *vcred, int create, int remove_dead) { - struct plain_sec *plsec = sec2plsec(sec); - struct ptlrpc_cli_ctx *ctx; + struct plain_sec *plsec = sec2plsec(sec); + struct ptlrpc_cli_ctx *ctx; read_lock(&plsec->pls_lock); ctx = plsec->pls_ctx; @@ -517,8 +517,8 @@ static int plain_flush_ctx_cache(struct ptlrpc_sec *sec, uid_t uid, int grace, int force) { - struct plain_sec *plsec = sec2plsec(sec); - struct ptlrpc_cli_ctx *ctx; + struct plain_sec *plsec = sec2plsec(sec); + struct ptlrpc_cli_ctx *ctx; /* do nothing unless caller want to flush for 'all' */ if (uid != -1) @@ -540,7 +540,7 @@ int plain_alloc_reqbuf(struct ptlrpc_sec *sec, int msgsize) { __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; - int alloc_len; + int alloc_len; buflens[PLAIN_PACK_HDR_OFF] = sizeof(struct plain_header); buflens[PLAIN_PACK_MSG_OFF] = msgsize; @@ -635,9 +635,9 @@ int plain_enlarge_reqbuf(struct ptlrpc_sec *sec, struct ptlrpc_request *req, int segment, int newsize) { - struct lustre_msg *newbuf; - int oldsize; - int newmsg_size, newbuf_size; + struct lustre_msg *newbuf; + int oldsize; + int newmsg_size, newbuf_size; LASSERT(req->rq_reqbuf); LASSERT(req->rq_reqbuf_len >= req->rq_reqlen); @@ -709,9 +709,9 @@ static struct ptlrpc_svc_ctx plain_svc_ctx = { static int plain_accept(struct ptlrpc_request *req) { - struct lustre_msg *msg = req->rq_reqbuf; + struct lustre_msg *msg = req->rq_reqbuf; struct plain_header *phdr; - int swabbed; + int swabbed; LASSERT(SPTLRPC_FLVR_POLICY(req->rq_flvr.sf_rpc) == SPTLRPC_POLICY_PLAIN); @@ -780,9 +780,9 @@ int plain_accept(struct ptlrpc_request *req) static int plain_alloc_rs(struct ptlrpc_request *req, int msgsize) { - struct ptlrpc_reply_state *rs; - __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; - int rs_size = sizeof(*rs); + struct ptlrpc_reply_state *rs; + __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; + int rs_size = sizeof(*rs); LASSERT(msgsize % 8 == 0); @@ -833,9 +833,9 @@ static int plain_authorize(struct ptlrpc_request *req) { struct ptlrpc_reply_state *rs = req->rq_reply_state; - struct lustre_msg_v2 *msg = rs->rs_repbuf; - struct plain_header *phdr; - int len; + struct lustre_msg_v2 *msg = rs->rs_repbuf; + struct plain_header *phdr; + int len; LASSERT(rs); LASSERT(msg); @@ -880,10 +880,10 @@ static int plain_svc_unwrap_bulk(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc) { - struct ptlrpc_reply_state *rs = req->rq_reply_state; + struct ptlrpc_reply_state *rs = req->rq_reply_state; struct ptlrpc_bulk_sec_desc *bsdr, *bsdv; - struct plain_bulk_token *tokenr; - int rc; + struct plain_bulk_token *tokenr; + int rc; LASSERT(req->rq_bulk_write); LASSERT(req->rq_pack_bulk); @@ -914,10 +914,10 @@ static int plain_svc_wrap_bulk(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc) { - struct ptlrpc_reply_state *rs = req->rq_reply_state; + struct ptlrpc_reply_state *rs = req->rq_reply_state; struct ptlrpc_bulk_sec_desc *bsdr, *bsdv; - struct plain_bulk_token *tokenv; - int rc; + struct plain_bulk_token *tokenv; + int rc; LASSERT(req->rq_bulk_read); LASSERT(req->rq_pack_bulk); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 454d1a8..25ccbcb 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -72,7 +72,7 @@ struct mutex ptlrpc_all_services_mutex; struct ptlrpc_request_buffer_desc * ptlrpc_alloc_rqbd(struct ptlrpc_service_part *svcpt) { - struct ptlrpc_service *svc = svcpt->scp_service; + struct ptlrpc_service *svc = svcpt->scp_service; struct ptlrpc_request_buffer_desc *rqbd; rqbd = kzalloc_node(sizeof(*rqbd), GFP_NOFS, @@ -121,10 +121,10 @@ ptlrpc_free_rqbd(struct ptlrpc_request_buffer_desc *rqbd) int ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int post) { - struct ptlrpc_service *svc = svcpt->scp_service; + struct ptlrpc_service *svc = svcpt->scp_service; struct ptlrpc_request_buffer_desc *rqbd; - int rc = 0; - int i; + int rc = 0; + int i; if (svcpt->scp_rqbd_allocating) goto try_post; @@ -186,7 +186,7 @@ ptlrpc_save_lock(struct ptlrpc_request *req, struct lustre_handle *lock, int mode, int no_ack) { struct ptlrpc_reply_state *rs = req->rq_reply_state; - int idx; + int idx; LASSERT(rs != NULL); LASSERT(rs->rs_nlocks < RS_MAX_LOCKS); @@ -275,8 +275,8 @@ static void rs_batch_init(struct rs_batch *b) static struct ptlrpc_hr_thread * ptlrpc_hr_select(struct ptlrpc_service_part *svcpt) { - struct ptlrpc_hr_partition *hrp; - unsigned int rotor; + struct ptlrpc_hr_partition *hrp; + unsigned int rotor; if (svcpt->scp_cpt >= 0 && svcpt->scp_service->srv_cptable == ptlrpc_hr.hr_cpt_table) { @@ -431,8 +431,8 @@ static int ptlrpc_server_post_idle_rqbds(struct ptlrpc_service_part *svcpt) { struct ptlrpc_request_buffer_desc *rqbd; - int rc; - int posted = 0; + int rc; + int posted = 0; for (;;) { spin_lock(&svcpt->scp_lock); @@ -489,11 +489,11 @@ static void ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, struct ptlrpc_service_conf *conf) { - struct ptlrpc_service_thr_conf *tc = &conf->psc_thr; - unsigned init; - unsigned total; - unsigned nthrs; - int weight; + struct ptlrpc_service_thr_conf *tc = &conf->psc_thr; + unsigned init; + unsigned total; + unsigned nthrs; + int weight; /* * Common code for estimating & validating threads number. @@ -517,7 +517,7 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, * be up to 8 * nthrs_max */ total = min(tc->tc_nthrs_max * 8, tc->tc_nthrs_user); nthrs = total / svc->srv_ncpts; - init = max(init, nthrs); + init = max(init, nthrs); goto out; } @@ -531,7 +531,7 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, nthrs = tc->tc_nthrs_base; if (svc->srv_ncpts == 1) { - int i; + int i; /* NB: Increase the base number if it's single partition * and total number of cores/HTs is larger or equal to 4. @@ -543,7 +543,7 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, } if (tc->tc_thr_factor != 0) { - int factor = tc->tc_thr_factor; + int factor = tc->tc_thr_factor; const int fade = 4; /* @@ -595,9 +595,9 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc, struct ptlrpc_service_part *svcpt, int cpt) { struct ptlrpc_at_array *array; - int size; - int index; - int rc; + int size; + int index; + int rc; svcpt->scp_cpt = cpt; INIT_LIST_HEAD(&svcpt->scp_threads); @@ -627,8 +627,8 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc, array = &svcpt->scp_at_array; size = at_est2timeout(at_max); - array->paa_size = size; - array->paa_count = 0; + array->paa_size = size; + array->paa_count = 0; array->paa_deadline = -1; /* allocate memory for scp_at_array (ptlrpc_at_array) */ @@ -683,15 +683,15 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, struct kset *parent, struct dentry *debugfs_entry) { - struct ptlrpc_service_cpt_conf *cconf = &conf->psc_cpt; - struct ptlrpc_service *service; - struct ptlrpc_service_part *svcpt; - struct cfs_cpt_table *cptable; - __u32 *cpts = NULL; - int ncpts; - int cpt; - int rc; - int i; + struct ptlrpc_service_cpt_conf *cconf = &conf->psc_cpt; + struct ptlrpc_service *service; + struct ptlrpc_service_part *svcpt; + struct cfs_cpt_table *cptable; + __u32 *cpts = NULL; + int ncpts; + int cpt; + int rc; + int i; LASSERT(conf->psc_buf.bc_nbufs > 0); LASSERT(conf->psc_buf.bc_buf_size >= @@ -707,7 +707,7 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, } else { ncpts = cfs_cpt_number(cptable); if (cconf->cc_pattern != NULL) { - struct cfs_expr_list *el; + struct cfs_expr_list *el; rc = cfs_expr_list_parse(cconf->cc_pattern, strlen(cconf->cc_pattern), @@ -737,9 +737,9 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, return ERR_PTR(-ENOMEM); } - service->srv_cptable = cptable; - service->srv_cpts = cpts; - service->srv_ncpts = ncpts; + service->srv_cptable = cptable; + service->srv_cpts = cpts; + service->srv_ncpts = ncpts; service->srv_cpt_bits = 0; /* it's zero already, easy to read... */ while ((1 << service->srv_cpt_bits) < cfs_cpt_number(cptable)) @@ -747,18 +747,18 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, /* public members */ spin_lock_init(&service->srv_lock); - service->srv_name = conf->psc_name; - service->srv_watchdog_factor = conf->psc_watchdog_factor; + service->srv_name = conf->psc_name; + service->srv_watchdog_factor = conf->psc_watchdog_factor; INIT_LIST_HEAD(&service->srv_list); /* for safety of cleanup */ /* buffer configuration */ - service->srv_nbuf_per_group = test_req_buffer_pressure ? + service->srv_nbuf_per_group = test_req_buffer_pressure ? 1 : conf->psc_buf.bc_nbufs; - service->srv_max_req_size = conf->psc_buf.bc_req_max_size + + service->srv_max_req_size = conf->psc_buf.bc_req_max_size + SPTLRPC_MAX_PAYLOAD; - service->srv_buf_size = conf->psc_buf.bc_buf_size; - service->srv_rep_portal = conf->psc_buf.bc_rep_portal; - service->srv_req_portal = conf->psc_buf.bc_req_portal; + service->srv_buf_size = conf->psc_buf.bc_buf_size; + service->srv_rep_portal = conf->psc_buf.bc_rep_portal; + service->srv_req_portal = conf->psc_buf.bc_req_portal; /* Increase max reply size to next power of two */ service->srv_max_reply_size = 1; @@ -766,10 +766,10 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, conf->psc_buf.bc_rep_max_size + SPTLRPC_MAX_PAYLOAD) service->srv_max_reply_size <<= 1; - service->srv_thread_name = conf->psc_thr.tc_thr_name; - service->srv_ctx_tags = conf->psc_thr.tc_ctx_tags; - service->srv_hpreq_ratio = PTLRPC_SVC_HP_RATIO; - service->srv_ops = conf->psc_ops; + service->srv_thread_name = conf->psc_thr.tc_thr_name; + service->srv_ctx_tags = conf->psc_thr.tc_ctx_tags; + service->srv_hpreq_ratio = PTLRPC_SVC_HP_RATIO; + service->srv_ops = conf->psc_ops; for (i = 0; i < ncpts; i++) { if (!conf->psc_thr.tc_cpu_affinity) @@ -859,11 +859,11 @@ static void ptlrpc_server_free_request(struct ptlrpc_request *req) void ptlrpc_server_drop_request(struct ptlrpc_request *req) { struct ptlrpc_request_buffer_desc *rqbd = req->rq_rqbd; - struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt; - struct ptlrpc_service *svc = svcpt->scp_service; - int refcount; - struct list_head *tmp; - struct list_head *nxt; + struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt; + struct ptlrpc_service *svc = svcpt->scp_service; + int refcount; + struct list_head *tmp; + struct list_head *nxt; if (!atomic_dec_and_test(&req->rq_refcount)) return; @@ -1387,7 +1387,7 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt) struct ptlrpc_at_array *array = &svcpt->scp_at_array; struct ptlrpc_request *rq, *n; struct list_head work_list; - __u32 index, count; + __u32 index, count; time_t deadline; time_t now = get_seconds(); long delay; @@ -1732,10 +1732,10 @@ static int ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt, struct ptlrpc_thread *thread) { - struct ptlrpc_service *svc = svcpt->scp_service; - struct ptlrpc_request *req; - __u32 deadline; - int rc; + struct ptlrpc_service *svc = svcpt->scp_service; + struct ptlrpc_request *req; + __u32 deadline; + int rc; spin_lock(&svcpt->scp_lock); if (list_empty(&svcpt->scp_req_incoming)) { @@ -1876,11 +1876,11 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, { struct ptlrpc_service *svc = svcpt->scp_service; struct ptlrpc_request *request; - struct timeval work_start; - struct timeval work_end; - long timediff; - int rc; - int fail_opc = 0; + struct timeval work_start; + struct timeval work_end; + long timediff; + int rc; + int fail_opc = 0; request = ptlrpc_server_request_get(svcpt, false); if (request == NULL) @@ -2032,10 +2032,10 @@ static int ptlrpc_handle_rs(struct ptlrpc_reply_state *rs) { struct ptlrpc_service_part *svcpt = rs->rs_svcpt; - struct ptlrpc_service *svc = svcpt->scp_service; - struct obd_export *exp; - int nlocks; - int been_handled; + struct ptlrpc_service *svc = svcpt->scp_service; + struct obd_export *exp; + int nlocks; + int been_handled; exp = rs->rs_export; @@ -2262,10 +2262,10 @@ ptlrpc_wait_event(struct ptlrpc_service_part *svcpt, */ static int ptlrpc_main(void *arg) { - struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg; - struct ptlrpc_service_part *svcpt = thread->t_svcpt; - struct ptlrpc_service *svc = svcpt->scp_service; - struct ptlrpc_reply_state *rs; + struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg; + struct ptlrpc_service_part *svcpt = thread->t_svcpt; + struct ptlrpc_service *svc = svcpt->scp_service; + struct ptlrpc_reply_state *rs; struct group_info *ginfo = NULL; struct lu_env *env; int counter = 0, rc = 0; @@ -2464,11 +2464,11 @@ static int hrt_dont_sleep(struct ptlrpc_hr_thread *hrt, */ static int ptlrpc_hr_main(void *arg) { - struct ptlrpc_hr_thread *hrt = (struct ptlrpc_hr_thread *)arg; - struct ptlrpc_hr_partition *hrp = hrt->hrt_partition; - LIST_HEAD (replies); - char threadname[20]; - int rc; + struct ptlrpc_hr_thread *hrt = (struct ptlrpc_hr_thread *)arg; + struct ptlrpc_hr_partition *hrp = hrt->hrt_partition; + LIST_HEAD (replies); + char threadname[20]; + int rc; snprintf(threadname, sizeof(threadname), "ptlrpc_hr%02d_%03d", hrp->hrp_cpt, hrt->hrt_id); @@ -2505,9 +2505,9 @@ static int ptlrpc_hr_main(void *arg) static void ptlrpc_stop_hr_threads(void) { - struct ptlrpc_hr_partition *hrp; - int i; - int j; + struct ptlrpc_hr_partition *hrp; + int i; + int j; ptlrpc_hr.hr_stopping = 1; @@ -2529,12 +2529,12 @@ static void ptlrpc_stop_hr_threads(void) static int ptlrpc_start_hr_threads(void) { - struct ptlrpc_hr_partition *hrp; - int i; - int j; + struct ptlrpc_hr_partition *hrp; + int i; + int j; cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) { - int rc = 0; + int rc = 0; for (j = 0; j < hrp->hrp_nthrs; j++) { struct ptlrpc_hr_thread *hrt = &hrp->hrp_thrs[j]; @@ -2561,9 +2561,9 @@ static int ptlrpc_start_hr_threads(void) static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt) { - struct l_wait_info lwi = { 0 }; - struct ptlrpc_thread *thread; - LIST_HEAD (zombie); + struct l_wait_info lwi = { 0 }; + struct ptlrpc_thread *thread; + LIST_HEAD (zombie); CDEBUG(D_INFO, "Stopping threads for service %s\n", svcpt->scp_service->srv_name); @@ -2612,7 +2612,7 @@ static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt) void ptlrpc_stop_all_threads(struct ptlrpc_service *svc) { struct ptlrpc_service_part *svcpt; - int i; + int i; ptlrpc_service_for_each_part(svcpt, i, svc) { if (svcpt->scp_service != NULL) @@ -2623,9 +2623,9 @@ EXPORT_SYMBOL(ptlrpc_stop_all_threads); int ptlrpc_start_threads(struct ptlrpc_service *svc) { - int rc = 0; - int i; - int j; + int rc = 0; + int i; + int j; /* We require 2 threads min, see note in ptlrpc_server_handle_request */ LASSERT(svc->srv_nthrs_cpt_init >= PTLRPC_NTHRS_INIT); @@ -2654,10 +2654,10 @@ EXPORT_SYMBOL(ptlrpc_start_threads); int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) { - struct l_wait_info lwi = { 0 }; - struct ptlrpc_thread *thread; - struct ptlrpc_service *svc; - int rc; + struct l_wait_info lwi = { 0 }; + struct ptlrpc_thread *thread; + struct ptlrpc_service *svc; + int rc; LASSERT(svcpt != NULL); @@ -2759,12 +2759,12 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) int ptlrpc_hr_init(void) { - struct ptlrpc_hr_partition *hrp; - struct ptlrpc_hr_thread *hrt; - int rc; - int i; - int j; - int weight; + struct ptlrpc_hr_partition *hrp; + struct ptlrpc_hr_thread *hrt; + int rc; + int i; + int j; + int weight; memset(&ptlrpc_hr, 0, sizeof(ptlrpc_hr)); ptlrpc_hr.hr_cpt_table = cfs_cpt_table; @@ -2817,8 +2817,8 @@ out: void ptlrpc_hr_fini(void) { - struct ptlrpc_hr_partition *hrp; - int i; + struct ptlrpc_hr_partition *hrp; + int i; if (ptlrpc_hr.hr_partitions == NULL) return; @@ -2858,8 +2858,8 @@ static void ptlrpc_wait_replies(struct ptlrpc_service_part *svcpt) static void ptlrpc_service_del_atimer(struct ptlrpc_service *svc) { - struct ptlrpc_service_part *svcpt; - int i; + struct ptlrpc_service_part *svcpt; + int i; /* early disarm AT timer... */ ptlrpc_service_for_each_part(svcpt, i, svc) { @@ -2871,11 +2871,11 @@ ptlrpc_service_del_atimer(struct ptlrpc_service *svc) static void ptlrpc_service_unlink_rqbd(struct ptlrpc_service *svc) { - struct ptlrpc_service_part *svcpt; + struct ptlrpc_service_part *svcpt; struct ptlrpc_request_buffer_desc *rqbd; - struct l_wait_info lwi; - int rc; - int i; + struct l_wait_info lwi; + int rc; + int i; /* All history will be culled when the next request buffer is * freed in ptlrpc_service_purge_all() */ @@ -2927,11 +2927,11 @@ ptlrpc_service_unlink_rqbd(struct ptlrpc_service *svc) static void ptlrpc_service_purge_all(struct ptlrpc_service *svc) { - struct ptlrpc_service_part *svcpt; - struct ptlrpc_request_buffer_desc *rqbd; - struct ptlrpc_request *req; - struct ptlrpc_reply_state *rs; - int i; + struct ptlrpc_service_part *svcpt; + struct ptlrpc_request_buffer_desc *rqbd; + struct ptlrpc_request *req; + struct ptlrpc_reply_state *rs; + int i; ptlrpc_service_for_each_part(svcpt, i, svc) { if (svcpt->scp_service == NULL) @@ -2995,9 +2995,9 @@ ptlrpc_service_purge_all(struct ptlrpc_service *svc) static void ptlrpc_service_free(struct ptlrpc_service *svc) { - struct ptlrpc_service_part *svcpt; - struct ptlrpc_at_array *array; - int i; + struct ptlrpc_service_part *svcpt; + struct ptlrpc_at_array *array; + int i; ptlrpc_service_for_each_part(svcpt, i, svc) { if (svcpt->scp_service == NULL) @@ -3056,9 +3056,9 @@ EXPORT_SYMBOL(ptlrpc_unregister_service); * to be shot, so it's intentionally non-aggressive. */ int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt) { - struct ptlrpc_request *request = NULL; - struct timeval right_now; - long timediff; + struct ptlrpc_request *request = NULL; + struct timeval right_now; + long timediff; do_gettimeofday(&right_now); @@ -3090,8 +3090,8 @@ int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt) int ptlrpc_service_health_check(struct ptlrpc_service *svc) { - struct ptlrpc_service_part *svcpt; - int i; + struct ptlrpc_service_part *svcpt; + int i; if (svc == NULL) return 0; -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 14:32:27 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:27 -0400 Subject: [lustre-devel] [PATCH v3 0/7] staging:lustre: remove tcpip abstraction from libcfs Message-ID: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Since libcfs no longer builds for user land we can move the TCPIP abstraction that exist to the LNET layer which is the only place that uses it. Also the migrated code will use native linux kernel APIs directly instead of with wrappers. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/13760 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Reviewed-by: Oleg Drokin James Simmons (7): staging:lustre: move tcpip abstraction staging:lustre: remove useless libcfs_sock_release staging:lustre: remove useless libcfs_sock_abort_accept staging:lustre: rename tcpip handling functions to lnet_* prefix staging:lustre: use available kernel wrappers in lib-socket.c staging:lustre: style cleanups for lib-socket.c staging:lustre: Update license and copyright for lib-socket.c .../staging/lustre/include/linux/libcfs/libcfs.h | 17 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 17 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 +- drivers/staging/lustre/lnet/lnet/Makefile | 7 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 55 +- drivers/staging/lustre/lnet/lnet/config.c | 21 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 595 +++++++++++++++++++ drivers/staging/lustre/lustre/libcfs/Makefile | 1 - .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 -------------------- 14 files changed, 688 insertions(+), 732 deletions(-) create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c From jsimmons at infradead.org Wed Jun 3 14:32:28 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:28 -0400 Subject: [lustre-devel] [PATCH v3 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <1433341954-654-1-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433341954-654-2-git-send-email-jsimmons@infradead.org> Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/Makefile | 7 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 624 ++++++++++++++++++++ drivers/staging/lustre/lustre/libcfs/Makefile | 1 - .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 ------------------- 4 files changed, 628 insertions(+), 627 deletions(-) create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c diff --git a/drivers/staging/lustre/lnet/lnet/Makefile b/drivers/staging/lustre/lnet/lnet/Makefile index 336b8ea..52492fb 100644 --- a/drivers/staging/lustre/lnet/lnet/Makefile +++ b/drivers/staging/lustre/lnet/lnet/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_LNET) += lnet.o -lnet-y := api-ni.o config.o lib-me.o lib-msg.o lib-eq.o \ - lib-md.o lib-ptl.o lib-move.o module.o lo.o router.o \ - router_proc.o acceptor.o peer.o +lnet-y := api-ni.o config.o \ + lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \ + lib-socket.o lib-move.o module.o lo.o \ + router.o router_proc.o acceptor.o peer.o diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c new file mode 100644 index 0000000..7f80612 --- /dev/null +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -0,0 +1,624 @@ +/* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + */ +#define DEBUG_SUBSYSTEM S_LNET + +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" + +#include +#include +#include +/* For sys_open & sys_close */ +#include + +static int +libcfs_sock_ioctl(int cmd, unsigned long arg) +{ + mm_segment_t oldmm = get_fs(); + struct socket *sock; + int rc; + struct file *sock_filp; + + rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + if (rc != 0) { + CERROR ("Can't create socket: %d\n", rc); + return rc; + } + + sock_filp = sock_alloc_file(sock, 0, NULL); + if (IS_ERR(sock_filp)) { + sock_release(sock); + rc = PTR_ERR(sock_filp); + goto out; + } + + set_fs(KERNEL_DS); + if (sock_filp->f_op->unlocked_ioctl) + rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); + set_fs(oldmm); + + fput(sock_filp); +out: + return rc; +} + +int +libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +{ + struct ifreq ifr; + int nob; + int rc; + __u32 val; + + nob = strnlen(name, IFNAMSIZ); + if (nob == IFNAMSIZ) { + CERROR("Interface name %s too long\n", name); + return -EINVAL; + } + + CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); + + strcpy(ifr.ifr_name, name); + rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); + + if (rc != 0) { + CERROR("Can't get flags for interface %s\n", name); + return rc; + } + + if ((ifr.ifr_flags & IFF_UP) == 0) { + CDEBUG(D_NET, "Interface %s down\n", name); + *up = 0; + *ip = *mask = 0; + return 0; + } + + *up = 1; + + strcpy(ifr.ifr_name, name); + ifr.ifr_addr.sa_family = AF_INET; + rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); + + if (rc != 0) { + CERROR("Can't get IP address for interface %s\n", name); + return rc; + } + + val = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; + *ip = ntohl(val); + + strcpy(ifr.ifr_name, name); + ifr.ifr_addr.sa_family = AF_INET; + rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); + + if (rc != 0) { + CERROR("Can't get netmask for interface %s\n", name); + return rc; + } + + val = ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr; + *mask = ntohl(val); + + return 0; +} + +EXPORT_SYMBOL(libcfs_ipif_query); + +int +libcfs_ipif_enumerate (char ***namesp) +{ + /* Allocate and fill in 'names', returning # interfaces/error */ + char **names; + int toobig; + int nalloc; + int nfound; + struct ifreq *ifr; + struct ifconf ifc; + int rc; + int nob; + int i; + + + nalloc = 16; /* first guess at max interfaces */ + toobig = 0; + for (;;) { + if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { + toobig = 1; + nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); + CWARN("Too many interfaces: only enumerating first %d\n", + nalloc); + } + + LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr)); + if (ifr == NULL) { + CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc); + rc = -ENOMEM; + goto out0; + } + + ifc.ifc_buf = (char *)ifr; + ifc.ifc_len = nalloc * sizeof(*ifr); + + rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); + + if (rc < 0) { + CERROR ("Error %d enumerating interfaces\n", rc); + goto out1; + } + + LASSERT (rc == 0); + + nfound = ifc.ifc_len/sizeof(*ifr); + LASSERT (nfound <= nalloc); + + if (nfound < nalloc || toobig) + break; + + LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); + nalloc *= 2; + } + + if (nfound == 0) + goto out1; + + LIBCFS_ALLOC(names, nfound * sizeof(*names)); + if (names == NULL) { + rc = -ENOMEM; + goto out1; + } + + for (i = 0; i < nfound; i++) { + + nob = strnlen (ifr[i].ifr_name, IFNAMSIZ); + if (nob == IFNAMSIZ) { + /* no space for terminating NULL */ + CERROR("interface name %.*s too long (%d max)\n", + nob, ifr[i].ifr_name, IFNAMSIZ); + rc = -ENAMETOOLONG; + goto out2; + } + + LIBCFS_ALLOC(names[i], IFNAMSIZ); + if (names[i] == NULL) { + rc = -ENOMEM; + goto out2; + } + + memcpy(names[i], ifr[i].ifr_name, nob); + names[i][nob] = 0; + } + + *namesp = names; + rc = nfound; + + out2: + if (rc < 0) + libcfs_ipif_free_enumeration(names, nfound); + out1: + LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); + out0: + return rc; +} + +EXPORT_SYMBOL(libcfs_ipif_enumerate); + +void +libcfs_ipif_free_enumeration (char **names, int n) +{ + int i; + + LASSERT (n > 0); + + for (i = 0; i < n && names[i] != NULL; i++) + LIBCFS_FREE(names[i], IFNAMSIZ); + + LIBCFS_FREE(names, n * sizeof(*names)); +} + +EXPORT_SYMBOL(libcfs_ipif_free_enumeration); + +int +libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +{ + int rc; + long ticks = timeout * HZ; + unsigned long then; + struct timeval tv; + + LASSERT (nob > 0); + /* Caller may pass a zero timeout if she thinks the socket buffer is + * empty enough to take the whole message immediately */ + + for (;;) { + struct kvec iov = { + .iov_base = buffer, + .iov_len = nob + }; + struct msghdr msg = { + .msg_flags = (timeout == 0) ? MSG_DONTWAIT : 0 + }; + + if (timeout != 0) { + /* Set send timeout to remaining time */ + tv = (struct timeval) { + .tv_sec = ticks / HZ, + .tv_usec = ((ticks % HZ) * 1000000) / HZ + }; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, + (char *)&tv, sizeof(tv)); + if (rc != 0) { + CERROR("Can't set socket send timeout %ld.%06d: %d\n", + (long)tv.tv_sec, (int)tv.tv_usec, rc); + return rc; + } + } + + then = jiffies; + rc = kernel_sendmsg(sock, &msg, &iov, 1, nob); + ticks -= jiffies - then; + + if (rc == nob) + return 0; + + if (rc < 0) + return rc; + + if (rc == 0) { + CERROR ("Unexpected zero rc\n"); + return -ECONNABORTED; + } + + if (ticks <= 0) + return -EAGAIN; + + buffer = ((char *)buffer) + rc; + nob -= rc; + } + + return 0; +} +EXPORT_SYMBOL(libcfs_sock_write); + +int +libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +{ + int rc; + long ticks = timeout * HZ; + unsigned long then; + struct timeval tv; + + LASSERT (nob > 0); + LASSERT (ticks > 0); + + for (;;) { + struct kvec iov = { + .iov_base = buffer, + .iov_len = nob + }; + struct msghdr msg = { + .msg_flags = 0 + }; + + /* Set receive timeout to remaining time */ + tv = (struct timeval) { + .tv_sec = ticks / HZ, + .tv_usec = ((ticks % HZ) * 1000000) / HZ + }; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, + (char *)&tv, sizeof(tv)); + if (rc != 0) { + CERROR("Can't set socket recv timeout %ld.%06d: %d\n", + (long)tv.tv_sec, (int)tv.tv_usec, rc); + return rc; + } + + then = jiffies; + rc = kernel_recvmsg(sock, &msg, &iov, 1, nob, 0); + ticks -= jiffies - then; + + if (rc < 0) + return rc; + + if (rc == 0) + return -ECONNRESET; + + buffer = ((char *)buffer) + rc; + nob -= rc; + + if (nob == 0) + return 0; + + if (ticks <= 0) + return -ETIMEDOUT; + } +} + +EXPORT_SYMBOL(libcfs_sock_read); + +static int +libcfs_sock_create (struct socket **sockp, int *fatal, + __u32 local_ip, int local_port) +{ + struct sockaddr_in locaddr; + struct socket *sock; + int rc; + int option; + + /* All errors are fatal except bind failure if the port is in use */ + *fatal = 1; + + rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + *sockp = sock; + if (rc != 0) { + CERROR ("Can't create socket: %d\n", rc); + return rc; + } + + option = 1; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + (char *)&option, sizeof (option)); + if (rc != 0) { + CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); + goto failed; + } + + if (local_ip != 0 || local_port != 0) { + memset(&locaddr, 0, sizeof(locaddr)); + locaddr.sin_family = AF_INET; + locaddr.sin_port = htons(local_port); + locaddr.sin_addr.s_addr = (local_ip == 0) ? + INADDR_ANY : htonl(local_ip); + + rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr, + sizeof(locaddr)); + if (rc == -EADDRINUSE) { + CDEBUG(D_NET, "Port %d already in use\n", local_port); + *fatal = 0; + goto failed; + } + if (rc != 0) { + CERROR("Error trying to bind to port %d: %d\n", + local_port, rc); + goto failed; + } + } + + return 0; + + failed: + sock_release(sock); + return rc; +} + +int +libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +{ + int option; + int rc; + + if (txbufsize != 0) { + option = txbufsize; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, + (char *)&option, sizeof (option)); + if (rc != 0) { + CERROR ("Can't set send buffer %d: %d\n", + option, rc); + return rc; + } + } + + if (rxbufsize != 0) { + option = rxbufsize; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, + (char *)&option, sizeof (option)); + if (rc != 0) { + CERROR ("Can't set receive buffer %d: %d\n", + option, rc); + return rc; + } + } + + return 0; +} + +EXPORT_SYMBOL(libcfs_sock_setbuf); + +int +libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) +{ + struct sockaddr_in sin; + int len = sizeof (sin); + int rc; + + rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, + remote ? 2 : 0); + if (rc != 0) { + CERROR ("Error %d getting sock %s IP/port\n", + rc, remote ? "peer" : "local"); + return rc; + } + + if (ip != NULL) + *ip = ntohl (sin.sin_addr.s_addr); + + if (port != NULL) + *port = ntohs (sin.sin_port); + + return 0; +} + +EXPORT_SYMBOL(libcfs_sock_getaddr); + +int +libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +{ + + if (txbufsize != NULL) { + *txbufsize = sock->sk->sk_sndbuf; + } + + if (rxbufsize != NULL) { + *rxbufsize = sock->sk->sk_rcvbuf; + } + + return 0; +} + +EXPORT_SYMBOL(libcfs_sock_getbuf); + +int +libcfs_sock_listen (struct socket **sockp, + __u32 local_ip, int local_port, int backlog) +{ + int fatal; + int rc; + + rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); + if (rc != 0) { + if (!fatal) + CERROR("Can't create socket: port %d already in use\n", + local_port); + return rc; + } + + rc = (*sockp)->ops->listen(*sockp, backlog); + if (rc == 0) + return 0; + + CERROR("Can't set listen backlog %d: %d\n", backlog, rc); + sock_release(*sockp); + return rc; +} + +EXPORT_SYMBOL(libcfs_sock_listen); + +int +libcfs_sock_accept (struct socket **newsockp, struct socket *sock) +{ + wait_queue_t wait; + struct socket *newsock; + int rc; + + init_waitqueue_entry(&wait, current); + + /* XXX this should add a ref to sock->ops->owner, if + * TCP could be a module */ + rc = sock_create_lite(PF_PACKET, sock->type, IPPROTO_TCP, &newsock); + if (rc) { + CERROR("Can't allocate socket\n"); + return rc; + } + + newsock->ops = sock->ops; + + rc = sock->ops->accept(sock, newsock, O_NONBLOCK); + if (rc == -EAGAIN) { + /* Nothing ready, so wait for activity */ + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(sk_sleep(sock->sk), &wait); + schedule(); + remove_wait_queue(sk_sleep(sock->sk), &wait); + set_current_state(TASK_RUNNING); + rc = sock->ops->accept(sock, newsock, O_NONBLOCK); + } + + if (rc != 0) + goto failed; + + *newsockp = newsock; + return 0; + + failed: + sock_release(newsock); + return rc; +} + +EXPORT_SYMBOL(libcfs_sock_accept); + +void +libcfs_sock_abort_accept (struct socket *sock) +{ + wake_up_all(sk_sleep(sock->sk)); +} + +EXPORT_SYMBOL(libcfs_sock_abort_accept); + +int +libcfs_sock_connect (struct socket **sockp, int *fatal, + __u32 local_ip, int local_port, + __u32 peer_ip, int peer_port) +{ + struct sockaddr_in srvaddr; + int rc; + + rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); + if (rc != 0) + return rc; + + memset (&srvaddr, 0, sizeof (srvaddr)); + srvaddr.sin_family = AF_INET; + srvaddr.sin_port = htons(peer_port); + srvaddr.sin_addr.s_addr = htonl(peer_ip); + + rc = (*sockp)->ops->connect(*sockp, + (struct sockaddr *)&srvaddr, sizeof(srvaddr), + 0); + if (rc == 0) + return 0; + + /* EADDRNOTAVAIL probably means we're already connected to the same + * peer/port on the same local port on a differently typed + * connection. Let our caller retry with a different local + * port... */ + *fatal = !(rc == -EADDRNOTAVAIL); + + CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET, + "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, + &local_ip, local_port, &peer_ip, peer_port); + + sock_release(*sockp); + return rc; +} + +EXPORT_SYMBOL(libcfs_sock_connect); + +void +libcfs_sock_release (struct socket *sock) +{ + sock_release(sock); +} + +EXPORT_SYMBOL(libcfs_sock_release); diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile b/drivers/staging/lustre/lustre/libcfs/Makefile index fabdd3e..ec98f44 100644 --- a/drivers/staging/lustre/lustre/libcfs/Makefile +++ b/drivers/staging/lustre/lustre/libcfs/Makefile @@ -2,7 +2,6 @@ obj-$(CONFIG_LUSTRE_FS) += libcfs.o libcfs-linux-objs := linux-tracefile.o linux-debug.o libcfs-linux-objs += linux-prim.o linux-cpu.o -libcfs-linux-objs += linux-tcpip.o libcfs-linux-objs += linux-curproc.o libcfs-linux-objs += linux-module.o libcfs-linux-objs += linux-crypto.o diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted file mode 100644 index f2462e7..0000000 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ -#define DEBUG_SUBSYSTEM S_LNET - -#include "../../../include/linux/libcfs/libcfs.h" - -#include -#include -#include -/* For sys_open & sys_close */ -#include - -static int -libcfs_sock_ioctl(int cmd, unsigned long arg) -{ - mm_segment_t oldmm = get_fs(); - struct socket *sock; - int rc; - struct file *sock_filp; - - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); - if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); - return rc; - } - - sock_filp = sock_alloc_file(sock, 0, NULL); - if (IS_ERR(sock_filp)) { - sock_release(sock); - rc = PTR_ERR(sock_filp); - goto out; - } - - set_fs(KERNEL_DS); - if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); - set_fs(oldmm); - - fput(sock_filp); -out: - return rc; -} - -int -libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) -{ - struct ifreq ifr; - int nob; - int rc; - __u32 val; - - nob = strnlen(name, IFNAMSIZ); - if (nob == IFNAMSIZ) { - CERROR("Interface name %s too long\n", name); - return -EINVAL; - } - - CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); - - strcpy(ifr.ifr_name, name); - rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); - - if (rc != 0) { - CERROR("Can't get flags for interface %s\n", name); - return rc; - } - - if ((ifr.ifr_flags & IFF_UP) == 0) { - CDEBUG(D_NET, "Interface %s down\n", name); - *up = 0; - *ip = *mask = 0; - return 0; - } - - *up = 1; - - strcpy(ifr.ifr_name, name); - ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); - - if (rc != 0) { - CERROR("Can't get IP address for interface %s\n", name); - return rc; - } - - val = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; - *ip = ntohl(val); - - strcpy(ifr.ifr_name, name); - ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); - - if (rc != 0) { - CERROR("Can't get netmask for interface %s\n", name); - return rc; - } - - val = ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr; - *mask = ntohl(val); - - return 0; -} - -EXPORT_SYMBOL(libcfs_ipif_query); - -int -libcfs_ipif_enumerate (char ***namesp) -{ - /* Allocate and fill in 'names', returning # interfaces/error */ - char **names; - int toobig; - int nalloc; - int nfound; - struct ifreq *ifr; - struct ifconf ifc; - int rc; - int nob; - int i; - - - nalloc = 16; /* first guess at max interfaces */ - toobig = 0; - for (;;) { - if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { - toobig = 1; - nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); - CWARN("Too many interfaces: only enumerating first %d\n", - nalloc); - } - - LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr)); - if (ifr == NULL) { - CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc); - rc = -ENOMEM; - goto out0; - } - - ifc.ifc_buf = (char *)ifr; - ifc.ifc_len = nalloc * sizeof(*ifr); - - rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); - - if (rc < 0) { - CERROR ("Error %d enumerating interfaces\n", rc); - goto out1; - } - - LASSERT (rc == 0); - - nfound = ifc.ifc_len/sizeof(*ifr); - LASSERT (nfound <= nalloc); - - if (nfound < nalloc || toobig) - break; - - LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); - nalloc *= 2; - } - - if (nfound == 0) - goto out1; - - LIBCFS_ALLOC(names, nfound * sizeof(*names)); - if (names == NULL) { - rc = -ENOMEM; - goto out1; - } - - for (i = 0; i < nfound; i++) { - - nob = strnlen (ifr[i].ifr_name, IFNAMSIZ); - if (nob == IFNAMSIZ) { - /* no space for terminating NULL */ - CERROR("interface name %.*s too long (%d max)\n", - nob, ifr[i].ifr_name, IFNAMSIZ); - rc = -ENAMETOOLONG; - goto out2; - } - - LIBCFS_ALLOC(names[i], IFNAMSIZ); - if (names[i] == NULL) { - rc = -ENOMEM; - goto out2; - } - - memcpy(names[i], ifr[i].ifr_name, nob); - names[i][nob] = 0; - } - - *namesp = names; - rc = nfound; - - out2: - if (rc < 0) - libcfs_ipif_free_enumeration(names, nfound); - out1: - LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); - out0: - return rc; -} - -EXPORT_SYMBOL(libcfs_ipif_enumerate); - -void -libcfs_ipif_free_enumeration (char **names, int n) -{ - int i; - - LASSERT (n > 0); - - for (i = 0; i < n && names[i] != NULL; i++) - LIBCFS_FREE(names[i], IFNAMSIZ); - - LIBCFS_FREE(names, n * sizeof(*names)); -} - -EXPORT_SYMBOL(libcfs_ipif_free_enumeration); - -int -libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) -{ - int rc; - long ticks = timeout * HZ; - unsigned long then; - struct timeval tv; - - LASSERT (nob > 0); - /* Caller may pass a zero timeout if she thinks the socket buffer is - * empty enough to take the whole message immediately */ - - for (;;) { - struct kvec iov = { - .iov_base = buffer, - .iov_len = nob - }; - struct msghdr msg = { - .msg_flags = (timeout == 0) ? MSG_DONTWAIT : 0 - }; - - if (timeout != 0) { - /* Set send timeout to remaining time */ - tv = (struct timeval) { - .tv_sec = ticks / HZ, - .tv_usec = ((ticks % HZ) * 1000000) / HZ - }; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, - (char *)&tv, sizeof(tv)); - if (rc != 0) { - CERROR("Can't set socket send timeout %ld.%06d: %d\n", - (long)tv.tv_sec, (int)tv.tv_usec, rc); - return rc; - } - } - - then = jiffies; - rc = kernel_sendmsg(sock, &msg, &iov, 1, nob); - ticks -= jiffies - then; - - if (rc == nob) - return 0; - - if (rc < 0) - return rc; - - if (rc == 0) { - CERROR ("Unexpected zero rc\n"); - return -ECONNABORTED; - } - - if (ticks <= 0) - return -EAGAIN; - - buffer = ((char *)buffer) + rc; - nob -= rc; - } - - return 0; -} -EXPORT_SYMBOL(libcfs_sock_write); - -int -libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) -{ - int rc; - long ticks = timeout * HZ; - unsigned long then; - struct timeval tv; - - LASSERT (nob > 0); - LASSERT (ticks > 0); - - for (;;) { - struct kvec iov = { - .iov_base = buffer, - .iov_len = nob - }; - struct msghdr msg = { - .msg_flags = 0 - }; - - /* Set receive timeout to remaining time */ - tv = (struct timeval) { - .tv_sec = ticks / HZ, - .tv_usec = ((ticks % HZ) * 1000000) / HZ - }; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, - (char *)&tv, sizeof(tv)); - if (rc != 0) { - CERROR("Can't set socket recv timeout %ld.%06d: %d\n", - (long)tv.tv_sec, (int)tv.tv_usec, rc); - return rc; - } - - then = jiffies; - rc = kernel_recvmsg(sock, &msg, &iov, 1, nob, 0); - ticks -= jiffies - then; - - if (rc < 0) - return rc; - - if (rc == 0) - return -ECONNRESET; - - buffer = ((char *)buffer) + rc; - nob -= rc; - - if (nob == 0) - return 0; - - if (ticks <= 0) - return -ETIMEDOUT; - } -} - -EXPORT_SYMBOL(libcfs_sock_read); - -static int -libcfs_sock_create (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port) -{ - struct sockaddr_in locaddr; - struct socket *sock; - int rc; - int option; - - /* All errors are fatal except bind failure if the port is in use */ - *fatal = 1; - - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); - *sockp = sock; - if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); - return rc; - } - - option = 1; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *)&option, sizeof (option)); - if (rc != 0) { - CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); - goto failed; - } - - if (local_ip != 0 || local_port != 0) { - memset(&locaddr, 0, sizeof(locaddr)); - locaddr.sin_family = AF_INET; - locaddr.sin_port = htons(local_port); - locaddr.sin_addr.s_addr = (local_ip == 0) ? - INADDR_ANY : htonl(local_ip); - - rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr, - sizeof(locaddr)); - if (rc == -EADDRINUSE) { - CDEBUG(D_NET, "Port %d already in use\n", local_port); - *fatal = 0; - goto failed; - } - if (rc != 0) { - CERROR("Error trying to bind to port %d: %d\n", - local_port, rc); - goto failed; - } - } - - return 0; - - failed: - sock_release(sock); - return rc; -} - -int -libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) -{ - int option; - int rc; - - if (txbufsize != 0) { - option = txbufsize; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, - (char *)&option, sizeof (option)); - if (rc != 0) { - CERROR ("Can't set send buffer %d: %d\n", - option, rc); - return rc; - } - } - - if (rxbufsize != 0) { - option = rxbufsize; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (char *)&option, sizeof (option)); - if (rc != 0) { - CERROR ("Can't set receive buffer %d: %d\n", - option, rc); - return rc; - } - } - - return 0; -} - -EXPORT_SYMBOL(libcfs_sock_setbuf); - -int -libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) -{ - struct sockaddr_in sin; - int len = sizeof (sin); - int rc; - - rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, - remote ? 2 : 0); - if (rc != 0) { - CERROR ("Error %d getting sock %s IP/port\n", - rc, remote ? "peer" : "local"); - return rc; - } - - if (ip != NULL) - *ip = ntohl (sin.sin_addr.s_addr); - - if (port != NULL) - *port = ntohs (sin.sin_port); - - return 0; -} - -EXPORT_SYMBOL(libcfs_sock_getaddr); - -int -libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) -{ - - if (txbufsize != NULL) { - *txbufsize = sock->sk->sk_sndbuf; - } - - if (rxbufsize != NULL) { - *rxbufsize = sock->sk->sk_rcvbuf; - } - - return 0; -} - -EXPORT_SYMBOL(libcfs_sock_getbuf); - -int -libcfs_sock_listen (struct socket **sockp, - __u32 local_ip, int local_port, int backlog) -{ - int fatal; - int rc; - - rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); - if (rc != 0) { - if (!fatal) - CERROR("Can't create socket: port %d already in use\n", - local_port); - return rc; - } - - rc = (*sockp)->ops->listen(*sockp, backlog); - if (rc == 0) - return 0; - - CERROR("Can't set listen backlog %d: %d\n", backlog, rc); - sock_release(*sockp); - return rc; -} - -EXPORT_SYMBOL(libcfs_sock_listen); - -int -libcfs_sock_accept (struct socket **newsockp, struct socket *sock) -{ - wait_queue_t wait; - struct socket *newsock; - int rc; - - init_waitqueue_entry(&wait, current); - - /* XXX this should add a ref to sock->ops->owner, if - * TCP could be a module */ - rc = sock_create_lite(PF_PACKET, sock->type, IPPROTO_TCP, &newsock); - if (rc) { - CERROR("Can't allocate socket\n"); - return rc; - } - - newsock->ops = sock->ops; - - rc = sock->ops->accept(sock, newsock, O_NONBLOCK); - if (rc == -EAGAIN) { - /* Nothing ready, so wait for activity */ - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(sk_sleep(sock->sk), &wait); - schedule(); - remove_wait_queue(sk_sleep(sock->sk), &wait); - set_current_state(TASK_RUNNING); - rc = sock->ops->accept(sock, newsock, O_NONBLOCK); - } - - if (rc != 0) - goto failed; - - *newsockp = newsock; - return 0; - - failed: - sock_release(newsock); - return rc; -} - -EXPORT_SYMBOL(libcfs_sock_accept); - -void -libcfs_sock_abort_accept (struct socket *sock) -{ - wake_up_all(sk_sleep(sock->sk)); -} - -EXPORT_SYMBOL(libcfs_sock_abort_accept); - -int -libcfs_sock_connect (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port) -{ - struct sockaddr_in srvaddr; - int rc; - - rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); - if (rc != 0) - return rc; - - memset (&srvaddr, 0, sizeof (srvaddr)); - srvaddr.sin_family = AF_INET; - srvaddr.sin_port = htons(peer_port); - srvaddr.sin_addr.s_addr = htonl(peer_ip); - - rc = (*sockp)->ops->connect(*sockp, - (struct sockaddr *)&srvaddr, sizeof(srvaddr), - 0); - if (rc == 0) - return 0; - - /* EADDRNOTAVAIL probably means we're already connected to the same - * peer/port on the same local port on a differently typed - * connection. Let our caller retry with a different local - * port... */ - *fatal = !(rc == -EADDRNOTAVAIL); - - CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET, - "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, - &local_ip, local_port, &peer_ip, peer_port); - - sock_release(*sockp); - return rc; -} - -EXPORT_SYMBOL(libcfs_sock_connect); - -void -libcfs_sock_release (struct socket *sock) -{ - sock_release(sock); -} - -EXPORT_SYMBOL(libcfs_sock_release); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 14:32:30 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:30 -0400 Subject: [lustre-devel] [PATCH v3 3/7] staging:lustre: remove useless libcfs_sock_abort_accept In-Reply-To: <1433341954-654-1-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433341954-654-4-git-send-email-jsimmons@infradead.org> Another one of those silly one line wrappers which is not needed. Replace libcfs_sock_abort_accept wrapper with a direct call to wake_up_all on the lnet_acceptor_state sock. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - drivers/staging/lustre/lnet/lnet/acceptor.c | 4 ++-- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index f469333..457ce9a 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -71,7 +71,6 @@ int libcfs_ipif_enumerate(char ***names); void libcfs_ipif_free_enumeration(char **names, int n); int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); int libcfs_sock_accept(struct socket **newsockp, struct socket *sock); -void libcfs_sock_abort_accept(struct socket *sock); int libcfs_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, int local_port, __u32 peer_ip, int peer_port); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index bc212f5..5187e65 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -377,7 +377,7 @@ lnet_acceptor(void *arg) continue; } - /* maybe we're waken up with libcfs_sock_abort_accept() */ + /* maybe the LNet acceptor thread has been waken */ if (lnet_acceptor_state.pta_shutdown) { sock_release(newsock); break; @@ -493,7 +493,7 @@ lnet_acceptor_stop(void) return; lnet_acceptor_state.pta_shutdown = 1; - libcfs_sock_abort_accept(lnet_acceptor_state.pta_sock); + wake_up_all(sk_sleep(lnet_acceptor_state.pta_sock->sk)); /* block until acceptor signals exit */ wait_for_completion(&lnet_acceptor_state.pta_signal); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 259db61..bb8d9c2 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -568,14 +568,6 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) EXPORT_SYMBOL(libcfs_sock_accept); -void -libcfs_sock_abort_accept (struct socket *sock) -{ - wake_up_all(sk_sleep(sock->sk)); -} - -EXPORT_SYMBOL(libcfs_sock_abort_accept); - int libcfs_sock_connect (struct socket **sockp, int *fatal, __u32 local_ip, int local_port, -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 14:32:33 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:33 -0400 Subject: [lustre-devel] [PATCH v3 6/7] staging:lustre: style cleanups for lib-socket.c In-Reply-To: <1433341954-654-1-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433341954-654-7-git-send-email-jsimmons@infradead.org> Handle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, etc. Signed-off-by: James Simmons --- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 210 +++++++++----------- 2 files changed, 98 insertions(+), 116 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index ee5cf35..4128a92 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1378,14 +1378,14 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, ksocknal_txlist_done(ni, &zombies, 1); ksocknal_peer_decref(peer); - failed_1: +failed_1: if (hello != NULL) LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t, kshm_ips[LNET_MAX_INTERFACES])); LIBCFS_FREE(conn, sizeof(*conn)); - failed_0: +failed_0: sock_release(sock); return rc; } diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 2d46a69..f0b187d 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -63,13 +63,13 @@ kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg) static int lnet_sock_ioctl(int cmd, unsigned long arg) { - struct file *sock_filp; - struct socket *sock; - int rc; + struct file *sock_filp; + struct socket *sock; + int rc; - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock); if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); + CERROR("Can't create socket: %d\n", rc); return rc; } @@ -88,12 +88,12 @@ out: } int -lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask) { - struct ifreq ifr; - int nob; - int rc; - __u32 val; + struct ifreq ifr; + int nob; + int rc; + __u32 val; nob = strnlen(name, IFNAMSIZ); if (nob == IFNAMSIZ) { @@ -101,7 +101,7 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return -EINVAL; } - CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); + CLASSERT(sizeof(ifr.ifr_name) >= IFNAMSIZ); strcpy(ifr.ifr_name, name); rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); @@ -116,7 +116,6 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) *ip = *mask = 0; return 0; } - *up = 1; strcpy(ifr.ifr_name, name); @@ -143,23 +142,21 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return 0; } - EXPORT_SYMBOL(lnet_ipif_query); int -lnet_ipif_enumerate (char ***namesp) +lnet_ipif_enumerate(char ***namesp) { /* Allocate and fill in 'names', returning # interfaces/error */ - char **names; - int toobig; - int nalloc; - int nfound; - struct ifreq *ifr; - struct ifconf ifc; - int rc; - int nob; - int i; - + char **names; + int toobig; + int nalloc; + int nfound; + struct ifreq *ifr; + struct ifconf ifc; + int rc; + int nob; + int i; nalloc = 16; /* first guess at max interfaces */ toobig = 0; @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp) if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { toobig = 1; nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); - CWARN("Too many interfaces: only enumerating first %d\n", - nalloc); + CWARN("Too many interfaces: only enumerating " + "first %d\n", nalloc); } LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr)); if (ifr == NULL) { - CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc); + CERROR("ENOMEM enumerating up to %d interfaces\n", + nalloc); rc = -ENOMEM; goto out0; } @@ -183,14 +181,14 @@ lnet_ipif_enumerate (char ***namesp) rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); if (rc < 0) { - CERROR ("Error %d enumerating interfaces\n", rc); + CERROR("Error %d enumerating interfaces\n", rc); goto out1; } - LASSERT (rc == 0); + LASSERT(rc == 0); nfound = ifc.ifc_len/sizeof(*ifr); - LASSERT (nfound <= nalloc); + LASSERT(nfound <= nalloc); if (nfound < nalloc || toobig) break; @@ -209,8 +207,7 @@ lnet_ipif_enumerate (char ***namesp) } for (i = 0; i < nfound; i++) { - - nob = strnlen (ifr[i].ifr_name, IFNAMSIZ); + nob = strnlen(ifr[i].ifr_name, IFNAMSIZ); if (nob == IFNAMSIZ) { /* no space for terminating NULL */ CERROR("interface name %.*s too long (%d max)\n", @@ -232,41 +229,39 @@ lnet_ipif_enumerate (char ***namesp) *namesp = names; rc = nfound; - out2: +out2: if (rc < 0) lnet_ipif_free_enumeration(names, nfound); - out1: +out1: LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); - out0: +out0: return rc; } - EXPORT_SYMBOL(lnet_ipif_enumerate); void -lnet_ipif_free_enumeration (char **names, int n) +lnet_ipif_free_enumeration(char **names, int n) { - int i; + int i; - LASSERT (n > 0); + LASSERT(n > 0); for (i = 0; i < n && names[i] != NULL; i++) LIBCFS_FREE(names[i], IFNAMSIZ); LIBCFS_FREE(names, n * sizeof(*names)); } - EXPORT_SYMBOL(lnet_ipif_free_enumeration); int -lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout) { - int rc; - long ticks = timeout * HZ; - unsigned long then; + int rc; + long ticks = timeout * HZ; + unsigned long then; struct timeval tv; - LASSERT (nob > 0); + LASSERT(nob > 0); /* Caller may pass a zero timeout if she thinks the socket buffer is * empty enough to take the whole message immediately */ @@ -286,9 +281,10 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) .tv_usec = ((ticks % HZ) * 1000000) / HZ }; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, - (char *)&tv, sizeof(tv)); + (char *)&tv, sizeof(tv)); if (rc != 0) { - CERROR("Can't set socket send timeout %ld.%06d: %d\n", + CERROR("Can't set socket send timeout " + "%ld.%06d: %d\n", (long)tv.tv_sec, (int)tv.tv_usec, rc); return rc; } @@ -305,7 +301,7 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) return rc; if (rc == 0) { - CERROR ("Unexpected zero rc\n"); + CERROR("Unexpected zero rc\n"); return -ECONNABORTED; } @@ -315,21 +311,20 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) buffer = ((char *)buffer) + rc; nob -= rc; } - return 0; } EXPORT_SYMBOL(lnet_sock_write); int -lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout) { - int rc; - long ticks = timeout * HZ; - unsigned long then; + int rc; + long ticks = timeout * HZ; + unsigned long then; struct timeval tv; - LASSERT (nob > 0); - LASSERT (ticks > 0); + LASSERT(nob > 0); + LASSERT(ticks > 0); for (;;) { struct kvec iov = { @@ -337,7 +332,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) .iov_len = nob }; struct msghdr msg = { - .msg_flags = 0 + .msg_flags = 0 }; /* Set receive timeout to remaining time */ @@ -346,7 +341,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) .tv_usec = ((ticks % HZ) * 1000000) / HZ }; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, - (char *)&tv, sizeof(tv)); + (char *)&tv, sizeof(tv)); if (rc != 0) { CERROR("Can't set socket recv timeout %ld.%06d: %d\n", (long)tv.tv_sec, (int)tv.tv_usec, rc); @@ -373,31 +368,30 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) return -ETIMEDOUT; } } - EXPORT_SYMBOL(lnet_sock_read); static int -lnet_sock_create (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port) +lnet_sock_create(struct socket **sockp, int *fatal, __u32 local_ip, + int local_port) { - struct sockaddr_in locaddr; - struct socket *sock; - int rc; - int option; + struct sockaddr_in locaddr; + struct socket *sock; + int rc; + int option; /* All errors are fatal except bind failure if the port is in use */ *fatal = 1; - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock); *sockp = sock; if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); + CERROR("Can't create socket: %d\n", rc); return rc; } option = 1; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); goto failed; @@ -423,27 +417,26 @@ lnet_sock_create (struct socket **sockp, int *fatal, goto failed; } } - return 0; - failed: +failed: sock_release(sock); return rc; } int -lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +lnet_sock_setbuf(struct socket *sock, int txbufsize, int rxbufsize) { - int option; - int rc; + int option; + int rc; if (txbufsize != 0) { option = txbufsize; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set send buffer %d: %d\n", - option, rc); + CERROR("Can't set send buffer %d: %d\n", + option, rc); return rc; } } @@ -451,70 +444,63 @@ lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) if (rxbufsize != 0) { option = rxbufsize; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set receive buffer %d: %d\n", - option, rc); + CERROR("Can't set receive buffer %d: %d\n", + option, rc); return rc; } } - return 0; } - EXPORT_SYMBOL(lnet_sock_setbuf); int -lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) +lnet_sock_getaddr(struct socket *sock, bool remote, __u32 *ip, int *port) { struct sockaddr_in sin; - int len = sizeof (sin); - int rc; + int len = sizeof(sin); + int rc; if (remote) rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len); else rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len); if (rc != 0) { - CERROR ("Error %d getting sock %s IP/port\n", - rc, remote ? "peer" : "local"); + CERROR("Error %d getting sock %s IP/port\n", + rc, remote ? "peer" : "local"); return rc; } if (ip != NULL) - *ip = ntohl (sin.sin_addr.s_addr); + *ip = ntohl(sin.sin_addr.s_addr); if (port != NULL) - *port = ntohs (sin.sin_port); + *port = ntohs(sin.sin_port); return 0; } - EXPORT_SYMBOL(lnet_sock_getaddr); int -lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +lnet_sock_getbuf(struct socket *sock, int *txbufsize, int *rxbufsize) { - - if (txbufsize != NULL) { + if (txbufsize != NULL) *txbufsize = sock->sk->sk_sndbuf; - } - if (rxbufsize != NULL) { + if (rxbufsize != NULL) *rxbufsize = sock->sk->sk_rcvbuf; - } return 0; } - EXPORT_SYMBOL(lnet_sock_getbuf); int -lnet_sock_listen (struct socket **sockp, - __u32 local_ip, int local_port, int backlog) +lnet_sock_listen(struct socket **sockp, __u32 local_ip, int local_port, + int backlog) { - int fatal; - int rc; + int fatal; + int rc; rc = lnet_sock_create(sockp, &fatal, local_ip, local_port); if (rc != 0) { @@ -532,15 +518,14 @@ lnet_sock_listen (struct socket **sockp, sock_release(*sockp); return rc; } - EXPORT_SYMBOL(lnet_sock_listen); int -lnet_sock_accept (struct socket **newsockp, struct socket *sock) +lnet_sock_accept(struct socket **newsockp, struct socket *sock) { - wait_queue_t wait; + wait_queue_t wait; struct socket *newsock; - int rc; + int rc; init_waitqueue_entry(&wait, current); @@ -571,26 +556,24 @@ lnet_sock_accept (struct socket **newsockp, struct socket *sock) *newsockp = newsock; return 0; - failed: +failed: sock_release(newsock); return rc; } - EXPORT_SYMBOL(lnet_sock_accept); int -lnet_sock_connect (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port) +lnet_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, + int local_port, __u32 peer_ip, int peer_port) { - struct sockaddr_in srvaddr; - int rc; + struct sockaddr_in srvaddr; + int rc; rc = lnet_sock_create(sockp, fatal, local_ip, local_port); if (rc != 0) return rc; - memset (&srvaddr, 0, sizeof (srvaddr)); + memset(&srvaddr, 0, sizeof(srvaddr)); srvaddr.sin_family = AF_INET; srvaddr.sin_port = htons(peer_port); srvaddr.sin_addr.s_addr = htonl(peer_ip); @@ -607,11 +590,10 @@ lnet_sock_connect (struct socket **sockp, int *fatal, *fatal = !(rc == -EADDRNOTAVAIL); CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET, - "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, - &local_ip, local_port, &peer_ip, peer_port); + "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, + &local_ip, local_port, &peer_ip, peer_port); sock_release(*sockp); return rc; } - EXPORT_SYMBOL(lnet_sock_connect); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 14:32:29 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:29 -0400 Subject: [lustre-devel] [PATCH v3 2/7] staging:lustre: remove useless libcfs_sock_release In-Reply-To: <1433341954-654-1-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433341954-654-3-git-send-email-jsimmons@infradead.org> There is no reason to have a one line exported function libcfs_sock_release. Instead we can call sock_release directly. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 8 ++++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index a789559..f469333 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -80,7 +80,6 @@ int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port); int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout); int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout); -void libcfs_sock_release(struct socket *sock); /* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512 diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 7b5d407..38e831f 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1386,7 +1386,7 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, LIBCFS_FREE(conn, sizeof(*conn)); failed_0: - libcfs_sock_release(sock); + sock_release(sock); return rc; } diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index c34378c..06531c1 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -519,7 +519,7 @@ ksocknal_connsock_decref(ksock_conn_t *conn) LASSERT(atomic_read(&conn->ksnc_sock_refcount) > 0); if (atomic_dec_and_test(&conn->ksnc_sock_refcount)) { LASSERT(conn->ksnc_closing); - libcfs_sock_release(conn->ksnc_sock); + sock_release(conn->ksnc_sock); conn->ksnc_sock = NULL; ksocknal_finalize_zcreq(conn); } diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 69d4b19..bc212f5 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -197,7 +197,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, goto failed; failed_sock: - libcfs_sock_release(sock); + sock_release(sock); failed: lnet_connect_console_error(rc, peer_nid, peer_ip, peer_port); return rc; @@ -379,7 +379,7 @@ lnet_acceptor(void *arg) /* maybe we're waken up with libcfs_sock_abort_accept() */ if (lnet_acceptor_state.pta_shutdown) { - libcfs_sock_release(newsock); + sock_release(newsock); break; } @@ -410,10 +410,10 @@ lnet_acceptor(void *arg) continue; failed: - libcfs_sock_release(newsock); + sock_release(newsock); } - libcfs_sock_release(lnet_acceptor_state.pta_sock); + sock_release(lnet_acceptor_state.pta_sock); lnet_acceptor_state.pta_sock = NULL; CDEBUG(D_NET, "Acceptor stopping\n"); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 7f80612..259db61 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -614,11 +614,3 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, } EXPORT_SYMBOL(libcfs_sock_connect); - -void -libcfs_sock_release (struct socket *sock) -{ - sock_release(sock); -} - -EXPORT_SYMBOL(libcfs_sock_release); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 14:32:31 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:31 -0400 Subject: [lustre-devel] [PATCH v3 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <1433341954-654-1-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433341954-654-5-git-send-email-jsimmons@infradead.org> With all the TCPIP handling done in the lnet layer we should rename all the functions with the prefix lnet_*. One other change done was changing the remove argument of lnet_sock_getaddr from a int to a bool. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 15 ----- .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 +++++ .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 11 ++-- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 ++--- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/acceptor.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/config.c | 21 +++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 66 +++++++++---------- 10 files changed, 110 insertions(+), 128 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 457ce9a..5dd9cdf 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -65,21 +65,6 @@ static inline int __is_po2(unsigned long long val) int libcfs_arch_init(void); void libcfs_arch_cleanup(void); -/* libcfs tcpip */ -int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); -int libcfs_ipif_enumerate(char ***names); -void libcfs_ipif_free_enumeration(char **names, int n); -int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); -int libcfs_sock_accept(struct socket **newsockp, struct socket *sock); -int libcfs_sock_connect(struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port); -int libcfs_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); -int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); -int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port); -int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout); -int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout); - /* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512 #define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023 diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index d84aa9a..ff07703 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -844,6 +844,22 @@ int lnet_acceptor_port(void); int lnet_acceptor_start(void); void lnet_acceptor_stop(void); +int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); +int lnet_ipif_enumerate(char ***names); +void lnet_ipif_free_enumeration(char **names, int n); +int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); +int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); +int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port); +int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout); +int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout); + +int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); +int lnet_sock_accept(struct socket **newsockp, struct socket *sock); +int lnet_sock_connect(struct socket **sockp, int *fatal, + __u32 local_ip, int local_port, + __u32 peer_ip, int peer_port); +void libcfs_sock_release(struct socket *sock); + void lnet_get_tunables(void); int lnet_peers_start_down(void); int lnet_peer_buffer_credits(lnet_ni_t *ni); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index a57c5c3..060b739 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2617,7 +2617,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname) int up; int rc; - rc = libcfs_ipif_query(ifname, &up, &ip, &netmask); + rc = lnet_ipif_query(ifname, &up, &ip, &netmask); if (rc != 0) { CERROR("Can't query IPoIB interface %s: %d\n", ifname, rc); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 38e831f..ee5cf35 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock) __u32 peer_ip; int peer_port; - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); LASSERT(rc == 0); /* we succeeded before */ LIBCFS_ALLOC(cr, sizeof(*cr)); @@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) int rc; int n; - n = libcfs_ipif_enumerate(&names); + n = lnet_ipif_enumerate(&names); if (n <= 0) { CERROR("Can't enumerate interfaces: %d\n", n); return n; @@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) if (!strcmp(names[i], "lo")) /* skip the loopback IF */ continue; - rc = libcfs_ipif_query(names[i], &up, &ip, &mask); + rc = lnet_ipif_query(names[i], &up, &ip, &mask); if (rc != 0) { CWARN("Can't get interface %s info: %d\n", names[i], rc); @@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) j++; } - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); if (j == 0) CERROR("Can't find any usable interfaces\n"); @@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni) if (ni->ni_interfaces[i] == NULL) break; - rc = libcfs_ipif_query( - ni->ni_interfaces[i], &up, + rc = lnet_ipif_query(ni->ni_interfaces[i], &up, &net->ksnn_interfaces[i].ksni_ipaddr, &net->ksnn_interfaces[i].ksni_netmask); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index a1a4ac0..fe2a83a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, timeout = active ? *ksocknal_tunables.ksnd_timeout : lnet_acceptor_timeout(); - rc = libcfs_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); + rc = lnet_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, return -EPROTO; } - rc = libcfs_sock_read(sock, &hello->kshm_version, - sizeof(hello->kshm_version), timeout); + rc = lnet_sock_read(sock, &hello->kshm_version, + sizeof(hello->kshm_version), timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index caeb347..34c6a72 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -39,9 +39,8 @@ int ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) { - int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1, - &conn->ksnc_ipaddr, - &conn->ksnc_port); + int rc = lnet_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr, + &conn->ksnc_port); /* Didn't need the {get,put}connsock dance to deref ksnc_sock... */ LASSERT(!conn->ksnc_closing); @@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) return rc; } - rc = libcfs_sock_getaddr(conn->ksnc_sock, 0, - &conn->ksnc_myipaddr, NULL); + rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL); if (rc != 0) { CERROR("Error %d getting sock local IP\n", rc); return rc; @@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int * return -ESHUTDOWN; } - rc = libcfs_sock_getbuf(sock, txmem, rxmem); + rc = lnet_sock_getbuf(sock, txmem, rxmem); if (rc == 0) { len = sizeof(*nagle); rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY, @@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock) } } - rc = libcfs_sock_setbuf(sock, - *ksocknal_tunables.ksnd_tx_buffer_size, - *ksocknal_tunables.ksnd_rx_buffer_size); + rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size, + *ksocknal_tunables.ksnd_rx_buffer_size); if (rc != 0) { CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", *ksocknal_tunables.ksnd_tx_buffer_size, diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index 1938d6a..986bce4 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -495,9 +495,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype); hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation); - rc = libcfs_sock_write(sock, hdr, sizeof(*hdr), - lnet_acceptor_timeout()); - + rc = lnet_sock_write(sock, hdr, sizeof(*hdr), lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", rc, &conn->ksnc_ipaddr, conn->ksnc_port); @@ -511,9 +509,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hello->kshm_ips[i] = __cpu_to_le32 (hello->kshm_ips[i]); } - rc = libcfs_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), - lnet_acceptor_timeout()); + rc = lnet_sock_write(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips, @@ -544,9 +542,8 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) LNET_UNLOCK(); } - rc = libcfs_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), - lnet_acceptor_timeout()); - + rc = lnet_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", rc, &conn->ksnc_ipaddr, conn->ksnc_port); @@ -556,9 +553,9 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) if (hello->kshm_nips == 0) return 0; - rc = libcfs_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), - lnet_acceptor_timeout()); + rc = lnet_sock_write(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips, @@ -583,9 +580,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, return -ENOMEM; } - rc = libcfs_sock_read(sock, &hdr->src_nid, - sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), - timeout); + rc = lnet_sock_read(sock, &hdr->src_nid, + sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), + timeout); if (rc != 0) { CERROR("Error %d reading rest of HELLO hdr from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -619,8 +616,8 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, if (hello->kshm_nips == 0) goto out; - rc = libcfs_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + rc = lnet_sock_read(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), timeout); if (rc != 0) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -656,10 +653,10 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout else conn->ksnc_flip = 1; - rc = libcfs_sock_read(sock, &hello->kshm_src_nid, - offsetof(ksock_hello_msg_t, kshm_ips) - - offsetof(ksock_hello_msg_t, kshm_src_nid), - timeout); + rc = lnet_sock_read(sock, &hello->kshm_src_nid, + offsetof(ksock_hello_msg_t, kshm_ips) - + offsetof(ksock_hello_msg_t, kshm_src_nid), + timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -687,8 +684,8 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout if (hello->kshm_nips == 0) return 0; - rc = libcfs_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + rc = lnet_sock_read(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), timeout); if (rc != 0) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 5187e65..1dc7c8a 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -155,9 +155,8 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, --port) { /* Iterate through reserved ports. */ - rc = libcfs_sock_connect(&sock, &fatal, - local_ip, port, - peer_ip, peer_port); + rc = lnet_sock_connect(&sock, &fatal, local_ip, port, peer_ip, + peer_port); if (rc != 0) { if (fatal) goto failed; @@ -184,8 +183,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, lnet_net_unlock(LNET_LOCK_EX); } - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); if (rc != 0) goto failed_sock; @@ -220,7 +218,7 @@ lnet_accept(struct socket *sock, __u32 magic) LASSERT(sizeof(cr) <= 16); /* not too big for the stack */ - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); LASSERT(rc == 0); /* we succeeded before */ if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) { @@ -234,8 +232,8 @@ lnet_accept(struct socket *sock, __u32 magic) memset(&cr, 0, sizeof(cr)); cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); + rc = lnet_sock_write(sock, &cr, sizeof(cr), + accept_timeout); if (rc != 0) CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n", @@ -257,9 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic) flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC); - rc = libcfs_sock_read(sock, &cr.acr_version, - sizeof(cr.acr_version), - accept_timeout); + rc = lnet_sock_read(sock, &cr.acr_version, sizeof(cr.acr_version), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request version from %pI4h\n", rc, &peer_ip); @@ -280,19 +277,17 @@ lnet_accept(struct socket *sock, __u32 magic) cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); - + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); if (rc != 0) CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n", peer_version, &peer_ip, rc); return -EPROTO; } - rc = libcfs_sock_read(sock, &cr.acr_nid, - sizeof(cr) - - offsetof(lnet_acceptor_connreq_t, acr_nid), - accept_timeout); + rc = lnet_sock_read(sock, &cr.acr_nid, + sizeof(cr) - + offsetof(lnet_acceptor_connreq_t, acr_nid), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request from %pI4h\n", rc, &peer_ip); @@ -343,8 +338,8 @@ lnet_acceptor(void *arg) cfs_block_allsigs(); - rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock, - 0, accept_port, accept_backlog); + rc = lnet_sock_listen(&lnet_acceptor_state.pta_sock, 0, accept_port, + accept_backlog); if (rc != 0) { if (rc == -EADDRINUSE) LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n", @@ -367,7 +362,7 @@ lnet_acceptor(void *arg) while (!lnet_acceptor_state.pta_shutdown) { - rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock); + rc = lnet_sock_accept(&newsock, lnet_acceptor_state.pta_sock); if (rc != 0) { if (rc != -EAGAIN) { CWARN("Accept error %d: pausing...\n", rc); @@ -383,7 +378,7 @@ lnet_acceptor(void *arg) break; } - rc = libcfs_sock_getaddr(newsock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(newsock, 1, &peer_ip, &peer_port); if (rc != 0) { CERROR("Can't determine new connection's address\n"); goto failed; @@ -395,8 +390,8 @@ lnet_acceptor(void *arg) goto failed; } - rc = libcfs_sock_read(newsock, &magic, sizeof(magic), - accept_timeout); + rc = lnet_sock_read(newsock, &magic, sizeof(magic), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request from %pI4h\n", rc, &peer_ip); diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 70bc809..efbb74a 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) __u32 *ipaddrs2; int nip; char **ifnames; - int nif = libcfs_ipif_enumerate(&ifnames); + int nif = lnet_ipif_enumerate(&ifnames); int i; int rc; @@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs)); if (ipaddrs == NULL) { CERROR("Can't allocate ipaddrs[%d]\n", nif); - libcfs_ipif_free_enumeration(ifnames, nif); + lnet_ipif_free_enumeration(ifnames, nif); return -ENOMEM; } @@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) if (!strcmp(ifnames[i], "lo")) continue; - rc = libcfs_ipif_query(ifnames[i], &up, - &ipaddrs[nip], &netmask); + rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask); if (rc != 0) { CWARN("Can't query interface %s: %d\n", ifnames[i], rc); @@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) nip++; } - libcfs_ipif_free_enumeration(ifnames, nif); + lnet_ipif_free_enumeration(ifnames, nif); if (nip == nif) { *ipaddrsp = ipaddrs; @@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) return -EPERM; } - rc = libcfs_ipif_query(ni->ni_interfaces[0], - &up, &ip, &netmask); + rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask); if (rc != 0) { CERROR("Net %s can't query interface %s: %d\n", libcfs_net2str(net), ni->ni_interfaces[0], rc); @@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) return 0; } - n = libcfs_ipif_enumerate(&names); + n = lnet_ipif_enumerate(&names); if (n <= 0) { CERROR("Net %s can't enumerate interfaces: %d\n", libcfs_net2str(net), n); @@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) if (!strcmp(names[i], "lo")) /* skip the loopback IF */ continue; - rc = libcfs_ipif_query(names[i], &up, &ip, &netmask); - + rc = lnet_ipif_query(names[i], &up, &ip, &netmask); if (rc != 0) { CWARN("Net %s can't query interface %s: %d\n", libcfs_net2str(net), names[i], rc); @@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) continue; } - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); ni->ni_nid = LNET_MKNID(net, ip); return 0; } CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net)); - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); return -ENOENT; } EXPORT_SYMBOL(lnet_set_ip_niaddr); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index bb8d9c2..2e87168 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -45,7 +45,7 @@ #include static int -libcfs_sock_ioctl(int cmd, unsigned long arg) +lnet_sock_ioctl(int cmd, unsigned long arg) { mm_segment_t oldmm = get_fs(); struct socket *sock; @@ -76,7 +76,7 @@ out: } int -libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) { struct ifreq ifr; int nob; @@ -92,8 +92,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); strcpy(ifr.ifr_name, name); - rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get flags for interface %s\n", name); return rc; @@ -110,8 +109,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) strcpy(ifr.ifr_name, name); ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get IP address for interface %s\n", name); return rc; @@ -122,8 +120,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) strcpy(ifr.ifr_name, name); ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get netmask for interface %s\n", name); return rc; @@ -135,10 +132,10 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return 0; } -EXPORT_SYMBOL(libcfs_ipif_query); +EXPORT_SYMBOL(lnet_ipif_query); int -libcfs_ipif_enumerate (char ***namesp) +lnet_ipif_enumerate (char ***namesp) { /* Allocate and fill in 'names', returning # interfaces/error */ char **names; @@ -172,8 +169,7 @@ libcfs_ipif_enumerate (char ***namesp) ifc.ifc_buf = (char *)ifr; ifc.ifc_len = nalloc * sizeof(*ifr); - rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); - + rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); if (rc < 0) { CERROR ("Error %d enumerating interfaces\n", rc); goto out1; @@ -226,17 +222,17 @@ libcfs_ipif_enumerate (char ***namesp) out2: if (rc < 0) - libcfs_ipif_free_enumeration(names, nfound); + lnet_ipif_free_enumeration(names, nfound); out1: LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); out0: return rc; } -EXPORT_SYMBOL(libcfs_ipif_enumerate); +EXPORT_SYMBOL(lnet_ipif_enumerate); void -libcfs_ipif_free_enumeration (char **names, int n) +lnet_ipif_free_enumeration (char **names, int n) { int i; @@ -248,10 +244,10 @@ libcfs_ipif_free_enumeration (char **names, int n) LIBCFS_FREE(names, n * sizeof(*names)); } -EXPORT_SYMBOL(libcfs_ipif_free_enumeration); +EXPORT_SYMBOL(lnet_ipif_free_enumeration); int -libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) { int rc; long ticks = timeout * HZ; @@ -310,10 +306,10 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) return 0; } -EXPORT_SYMBOL(libcfs_sock_write); +EXPORT_SYMBOL(lnet_sock_write); int -libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) { int rc; long ticks = timeout * HZ; @@ -366,10 +362,10 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) } } -EXPORT_SYMBOL(libcfs_sock_read); +EXPORT_SYMBOL(lnet_sock_read); static int -libcfs_sock_create (struct socket **sockp, int *fatal, +lnet_sock_create (struct socket **sockp, int *fatal, __u32 local_ip, int local_port) { struct sockaddr_in locaddr; @@ -424,7 +420,7 @@ libcfs_sock_create (struct socket **sockp, int *fatal, } int -libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) { int option; int rc; @@ -454,10 +450,10 @@ libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) return 0; } -EXPORT_SYMBOL(libcfs_sock_setbuf); +EXPORT_SYMBOL(lnet_sock_setbuf); int -libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) +lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) { struct sockaddr_in sin; int len = sizeof (sin); @@ -480,10 +476,10 @@ libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) return 0; } -EXPORT_SYMBOL(libcfs_sock_getaddr); +EXPORT_SYMBOL(lnet_sock_getaddr); int -libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) { if (txbufsize != NULL) { @@ -497,16 +493,16 @@ libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) return 0; } -EXPORT_SYMBOL(libcfs_sock_getbuf); +EXPORT_SYMBOL(lnet_sock_getbuf); int -libcfs_sock_listen (struct socket **sockp, +lnet_sock_listen (struct socket **sockp, __u32 local_ip, int local_port, int backlog) { int fatal; int rc; - rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); + rc = lnet_sock_create(sockp, &fatal, local_ip, local_port); if (rc != 0) { if (!fatal) CERROR("Can't create socket: port %d already in use\n", @@ -523,10 +519,10 @@ libcfs_sock_listen (struct socket **sockp, return rc; } -EXPORT_SYMBOL(libcfs_sock_listen); +EXPORT_SYMBOL(lnet_sock_listen); int -libcfs_sock_accept (struct socket **newsockp, struct socket *sock) +lnet_sock_accept (struct socket **newsockp, struct socket *sock) { wait_queue_t wait; struct socket *newsock; @@ -566,17 +562,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) return rc; } -EXPORT_SYMBOL(libcfs_sock_accept); +EXPORT_SYMBOL(lnet_sock_accept); int -libcfs_sock_connect (struct socket **sockp, int *fatal, +lnet_sock_connect (struct socket **sockp, int *fatal, __u32 local_ip, int local_port, __u32 peer_ip, int peer_port) { struct sockaddr_in srvaddr; int rc; - rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); + rc = lnet_sock_create(sockp, fatal, local_ip, local_port); if (rc != 0) return rc; @@ -605,4 +601,4 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, return rc; } -EXPORT_SYMBOL(libcfs_sock_connect); +EXPORT_SYMBOL(lnet_sock_connect); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 14:32:32 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:32 -0400 Subject: [lustre-devel] [PATCH v3 5/7] staging:lustre: use available kernel wrappers in lib-socket.c In-Reply-To: <1433341954-654-1-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433341954-654-6-git-send-email-jsimmons@infradead.org> Instead of handling calls to struct proto ourselves we can use equivalent kernel wrappers. No wrapper exist for unlocked ioctl handling so we create one here for our use. I expect some day that function will be integrated into sock.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 47 ++++++++++++++++--------- 1 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 2e87168..2d46a69 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -35,22 +35,37 @@ */ #define DEBUG_SUBSYSTEM S_LNET -#include "../../include/linux/libcfs/libcfs.h" -#include "../../include/linux/lnet/lib-lnet.h" - #include #include +#include #include +#include /* For sys_open & sys_close */ #include +#include + +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" + +static int +kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg) +{ + mm_segment_t oldfs = get_fs(); + int err; + + set_fs(KERNEL_DS); + err = filp->f_op->unlocked_ioctl(filp, cmd, arg); + set_fs(oldfs); + + return err; +} static int lnet_sock_ioctl(int cmd, unsigned long arg) { - mm_segment_t oldmm = get_fs(); + struct file *sock_filp; struct socket *sock; int rc; - struct file *sock_filp; rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); if (rc != 0) { @@ -65,10 +80,7 @@ lnet_sock_ioctl(int cmd, unsigned long arg) goto out; } - set_fs(KERNEL_DS); - if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); - set_fs(oldmm); + rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg); fput(sock_filp); out: @@ -398,8 +410,8 @@ lnet_sock_create (struct socket **sockp, int *fatal, locaddr.sin_addr.s_addr = (local_ip == 0) ? INADDR_ANY : htonl(local_ip); - rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr, - sizeof(locaddr)); + rc = kernel_bind(sock, (struct sockaddr *)&locaddr, + sizeof(locaddr)); if (rc == -EADDRINUSE) { CDEBUG(D_NET, "Port %d already in use\n", local_port); *fatal = 0; @@ -459,8 +471,10 @@ lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) int len = sizeof (sin); int rc; - rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, - remote ? 2 : 0); + if (remote) + rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len); + else + rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len); if (rc != 0) { CERROR ("Error %d getting sock %s IP/port\n", rc, remote ? "peer" : "local"); @@ -510,7 +524,7 @@ lnet_sock_listen (struct socket **sockp, return rc; } - rc = (*sockp)->ops->listen(*sockp, backlog); + rc = kernel_listen(*sockp, backlog); if (rc == 0) return 0; @@ -581,9 +595,8 @@ lnet_sock_connect (struct socket **sockp, int *fatal, srvaddr.sin_port = htons(peer_port); srvaddr.sin_addr.s_addr = htonl(peer_ip); - rc = (*sockp)->ops->connect(*sockp, - (struct sockaddr *)&srvaddr, sizeof(srvaddr), - 0); + rc = kernel_connect(*sockp, (struct sockaddr *)&srvaddr, + sizeof(srvaddr), 0); if (rc == 0) return 0; -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 14:32:34 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 10:32:34 -0400 Subject: [lustre-devel] [PATCH v3 7/7] staging:lustre: Update license and copyright for lib-socket.c In-Reply-To: <1433341954-654-1-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433341954-654-8-git-send-email-jsimmons@infradead.org> Point to the right place for GNU license. Update Intel copyright. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index f0b187d..2f8443c 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,11 +23,11 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. */ #define DEBUG_SUBSYSTEM S_LNET -- 1.7.1 From joe at perches.com Wed Jun 3 14:42:54 2015 From: joe at perches.com (Joe Perches) Date: Wed, 03 Jun 2015 07:42:54 -0700 Subject: [lustre-devel] [PATCH v3 6/7] staging:lustre: style cleanups for lib-socket.c In-Reply-To: <1433341954-654-7-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> <1433341954-654-7-git-send-email-jsimmons@infradead.org> Message-ID: <1433342574.4861.126.camel@perches.com> On Wed, 2015-06-03 at 10:32 -0400, James Simmons wrote: > Handle all the style issues reported by checkpatch.pl. > Remove general white spaces, spaces in function calls, > etc. [] > @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp) > if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { > toobig = 1; > nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); > - CWARN("Too many interfaces: only enumerating first %d\n", > - nalloc); > + CWARN("Too many interfaces: only enumerating " > + "first %d\n", nalloc); Please don't split single strings into multiple parts. For a patch like this it'd be nice to specify that both "git diff -w" and scripts/objdiff shows no differences. Unless it does... From sudipm.mukherjee at gmail.com Wed Jun 3 16:33:23 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Wed, 3 Jun 2015 22:03:23 +0530 Subject: [lustre-devel] [PATCH v3 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <1433341954-654-5-git-send-email-jsimmons@infradead.org> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> <1433341954-654-5-git-send-email-jsimmons@infradead.org> Message-ID: <20150603163323.GA5314@sudip-PC> On Wed, Jun 03, 2015 at 10:32:31AM -0400, James Simmons wrote: > With all the TCPIP handling done in the lnet layer we should > rename all the functions with the prefix lnet_*. One other > change done was changing the remove argument of lnet_sock_getaddr > from a int to a bool. > > Signed-off-by: James Simmons checkpatch is complaining about unrecognized email address. regards sudip From simmonsja at ornl.gov Wed Jun 3 16:38:36 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 3 Jun 2015 16:38:36 +0000 Subject: [lustre-devel] [PATCH v3 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <20150603163323.GA5314@sudip-PC> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> <1433341954-654-5-git-send-email-jsimmons@infradead.org> <20150603163323.GA5314@sudip-PC> Message-ID: <60d0f4468f1b401ea3643d5efcdb0b2d@EXCHCS32.ornl.gov> >On Wed, Jun 03, 2015 at 10:32:31AM -0400, James Simmons wrote: >> With all the TCPIP handling done in the lnet layer we should >> rename all the functions with the prefix lnet_*. One other >> change done was changing the remove argument of lnet_sock_getaddr >> from a int to a bool. >> >> Signed-off-by: James Simmons >checkpatch is complaining about unrecognized email address. For some reason git format will mangle some of email addresses on me. Any idea why it does that? From sudipm.mukherjee at gmail.com Wed Jun 3 16:42:55 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Wed, 3 Jun 2015 22:12:55 +0530 Subject: [lustre-devel] [PATCH v3 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <60d0f4468f1b401ea3643d5efcdb0b2d@EXCHCS32.ornl.gov> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> <1433341954-654-5-git-send-email-jsimmons@infradead.org> <20150603163323.GA5314@sudip-PC> <60d0f4468f1b401ea3643d5efcdb0b2d@EXCHCS32.ornl.gov> Message-ID: <20150603164255.GC5314@sudip-PC> On Wed, Jun 03, 2015 at 04:38:36PM +0000, Simmons, James A. wrote: > >On Wed, Jun 03, 2015 at 10:32:31AM -0400, James Simmons wrote: > >> With all the TCPIP handling done in the lnet layer we should > >> rename all the functions with the prefix lnet_*. One other > >> change done was changing the remove argument of lnet_sock_getaddr > >> from a int to a bool. > >> > >> Signed-off-by: James Simmons > >checkpatch is complaining about unrecognized email address. > > For some reason git format will mangle some of email addresses on me. > Any idea why it does that? sorry, no. maybe you need to report it as bug to git. regards sudip > From simmonsja at ornl.gov Wed Jun 3 17:12:50 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 3 Jun 2015 17:12:50 +0000 Subject: [lustre-devel] [PATCH v3 6/7] staging:lustre: style cleanups for lib-socket.c In-Reply-To: <1433342574.4861.126.camel@perches.com> References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> <1433341954-654-7-git-send-email-jsimmons@infradead.org> <1433342574.4861.126.camel@perches.com> Message-ID: >On Wed, 2015-06-03 at 10:32 -0400, James Simmons wrote: >> Handle all the style issues reported by checkpatch.pl. >> Remove general white spaces, spaces in function calls, >> etc. >[] >> @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp) >> if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { >> toobig = 1; >> nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); >> - CWARN("Too many interfaces: only enumerating first %d\n", >> - nalloc); >> + CWARN("Too many interfaces: only enumerating " >> + "first %d\n", nalloc); > >Please don't split single strings into multiple parts. > >For a patch like this it'd be nice to specify that both >"git diff -w" and scripts/objdiff shows no differences. > >Unless it does... Two patches have mistakes. Should I send a new series or do a in-reply instead. From joe at perches.com Wed Jun 3 17:16:44 2015 From: joe at perches.com (Joe Perches) Date: Wed, 03 Jun 2015 10:16:44 -0700 Subject: [lustre-devel] [PATCH v3 6/7] staging:lustre: style cleanups for lib-socket.c In-Reply-To: References: <1433341954-654-1-git-send-email-jsimmons@infradead.org> <1433341954-654-7-git-send-email-jsimmons@infradead.org> <1433342574.4861.126.camel@perches.com> Message-ID: <1433351804.4861.134.camel@perches.com> On Wed, 2015-06-03 at 17:12 +0000, Simmons, James A. wrote: > >On Wed, 2015-06-03 at 10:32 -0400, James Simmons wrote: > >> Handle all the style issues reported by checkpatch.pl. > >> Remove general white spaces, spaces in function calls, > >> etc. > >[] > >> @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp) > >> if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { > >> toobig = 1; > >> nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); > >> - CWARN("Too many interfaces: only enumerating first %d\n", > >> - nalloc); > >> + CWARN("Too many interfaces: only enumerating " > >> + "first %d\n", nalloc); > > > >Please don't split single strings into multiple parts. > > > >For a patch like this it'd be nice to specify that both > >"git diff -w" and scripts/objdiff shows no differences. > > > >Unless it does... > > Two patches have mistakes. Should I send a new series or do a in-reply instead. Most of the time, it's better to send a new series. If any of the unmodified patches are very large, like 100KB+, then it can be better to send individually updated patches. From jmiller at cray.com Wed Jun 3 18:23:40 2015 From: jmiller at cray.com (Justin Miller) Date: Wed, 3 Jun 2015 18:23:40 +0000 Subject: [lustre-devel] wiki.lustre.org and #lustre IRC channel Message-ID: <8B0641CE-352F-4DD3-8011-022EA64C6295@cray.com> As part of the move to http://wiki.lustre.org/, new pages are being created and content migrated, including the new page http://wiki.lustre.org/Mailing_Lists_and_IRC I wanted to highlight that we have a #lustre IRC channel on the Freenode IRC network. Point your client towards chat.freenode.net and join #lustre, or use the Freenode Webchat in your browser: https://webchat.freenode.net/?channels=lustre The IRC channel might be a helpful tool to coordinate work on the upstream kernel client. - Justin Miller From paf at cray.com Wed Jun 3 18:32:05 2015 From: paf at cray.com (Patrick Farrell) Date: Wed, 3 Jun 2015 13:32:05 -0500 Subject: [lustre-devel] Lustre and libreadline Message-ID: <556F4825.1050408@cray.com> Good afternoon, Cray has recently discovered that 'lfs getstripe' crashes with a null pointer if it is not built with libreadline (Found in 'readline-devel'). When built without libreadline, Lustre uses its own implementation of the readline components it needs. (Look for "HAVE_LIBREADLINE" in libcfs/libcfs/util/parser.c) This is the source of the null pointer. I think libreadline should be available on every platform we wish to build Lustre on, so I'd rather not fix the broken internal version of it. Given that, is there any objection to adding an explicit BuildRequires to the spec, making it mandatory in the config process, and removing all traces of Lustre's internal readline implementation? If not, I'll open a Jira ticket to do this. - Patrick From bass6 at llnl.gov Wed Jun 3 18:57:16 2015 From: bass6 at llnl.gov (Ned Bass) Date: Wed, 3 Jun 2015 11:57:16 -0700 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <556F4825.1050408@cray.com> References: <556F4825.1050408@cray.com> Message-ID: <20150603185716.GA10033@llnl.gov> Hi Patrick, LLNL builds a stand-alone liblustreapi library for our BG/Q compute nodes, and readline isn't available there. Now, since we just install the library and not the utils we don't actually need readline. Perhaps rather than making the readline configurue check stricly mandatory, we could add a --disable-utils option which, if specified, would make readline optional. Thanks, Ned On Wed, Jun 03, 2015 at 01:32:05PM -0500, Patrick Farrell wrote: > Good afternoon, > > Cray has recently discovered that 'lfs getstripe' crashes with a > null pointer if it is not built with libreadline (Found in > 'readline-devel'). > > When built without libreadline, Lustre uses its own implementation > of the readline components it needs. (Look for "HAVE_LIBREADLINE" > in libcfs/libcfs/util/parser.c) This is the source of the null > pointer. > > I think libreadline should be available on every platform we wish to > build Lustre on, so I'd rather not fix the broken internal version > of it. Given that, is there any objection to adding an explicit > BuildRequires to the spec, making it mandatory in the config > process, and removing all traces of Lustre's internal readline > implementation? If not, I'll open a Jira ticket to do this. > > - Patrick > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From colin.faber at seagate.com Wed Jun 3 19:52:37 2015 From: colin.faber at seagate.com (Colin Faber) Date: Wed, 3 Jun 2015 13:52:37 -0600 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 Message-ID: Hi, This is probably more a question for the folks at Intel.. Is there an ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such changes would allow for google logins to function correctly. -cf -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Wed Jun 3 19:55:19 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 03 Jun 2015 12:55:19 -0700 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: References: Message-ID: <556F5BA7.1020301@llnl.gov> I think you might have that backwards. Google has _stopped_ supporting OpenID 2.0. To the best of my knowledge no version of gerrit yet supports Google's new OpenID Connect system. Chris On 06/03/2015 12:52 PM, Colin Faber wrote: > Hi, > > This is probably more a question for the folks at Intel.. Is there an > ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such > changes would allow for google logins to function correctly. > > -cf > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From jsimmons at infradead.org Wed Jun 3 19:57:06 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:06 -0400 Subject: [lustre-devel] [PATCH v4 0/7] staging:lustre: remove tcpip abstraction from libcfs Message-ID: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Since libcfs no longer builds for user land we can move the TCPIP abstraction that exist to the LNET layer which is the only place that uses it. Also the migrated code will use native linux kernel APIs directly instead of with wrappers. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/13760 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Reviewed-by: Oleg Drokin James Simmons (7): staging:lustre: move tcpip abstraction staging:lustre: remove useless libcfs_sock_release staging:lustre: remove useless libcfs_sock_abort_accept staging:lustre: rename tcpip handling functions to lnet_* prefix staging:lustre: use available kernel wrappers in lib-socket.c staging:lustre: style cleanups for lib-socket.c staging:lustre: Update license and copyright for lib-socket.c .../staging/lustre/include/linux/libcfs/libcfs.h | 17 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 17 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 +- drivers/staging/lustre/lnet/lnet/Makefile | 7 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 55 +- drivers/staging/lustre/lnet/lnet/config.c | 21 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 595 +++++++++++++++++++ drivers/staging/lustre/lustre/libcfs/Makefile | 1 - .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 -------------------- 14 files changed, 688 insertions(+), 732 deletions(-) create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c From jsimmons at infradead.org Wed Jun 3 19:57:07 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:07 -0400 Subject: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433361433-24976-2-git-send-email-jsimmons@infradead.org> Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/Makefile | 7 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 624 ++++++++++++++++++++ drivers/staging/lustre/lustre/libcfs/Makefile | 1 - .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 ------------------- 4 files changed, 628 insertions(+), 627 deletions(-) create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c diff --git a/drivers/staging/lustre/lnet/lnet/Makefile b/drivers/staging/lustre/lnet/lnet/Makefile index 336b8ea..52492fb 100644 --- a/drivers/staging/lustre/lnet/lnet/Makefile +++ b/drivers/staging/lustre/lnet/lnet/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_LNET) += lnet.o -lnet-y := api-ni.o config.o lib-me.o lib-msg.o lib-eq.o \ - lib-md.o lib-ptl.o lib-move.o module.o lo.o router.o \ - router_proc.o acceptor.o peer.o +lnet-y := api-ni.o config.o \ + lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \ + lib-socket.o lib-move.o module.o lo.o \ + router.o router_proc.o acceptor.o peer.o diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c new file mode 100644 index 0000000..7f80612 --- /dev/null +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -0,0 +1,624 @@ +/* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + */ +#define DEBUG_SUBSYSTEM S_LNET + +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" + +#include +#include +#include +/* For sys_open & sys_close */ +#include + +static int +libcfs_sock_ioctl(int cmd, unsigned long arg) +{ + mm_segment_t oldmm = get_fs(); + struct socket *sock; + int rc; + struct file *sock_filp; + + rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + if (rc != 0) { + CERROR ("Can't create socket: %d\n", rc); + return rc; + } + + sock_filp = sock_alloc_file(sock, 0, NULL); + if (IS_ERR(sock_filp)) { + sock_release(sock); + rc = PTR_ERR(sock_filp); + goto out; + } + + set_fs(KERNEL_DS); + if (sock_filp->f_op->unlocked_ioctl) + rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); + set_fs(oldmm); + + fput(sock_filp); +out: + return rc; +} + +int +libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +{ + struct ifreq ifr; + int nob; + int rc; + __u32 val; + + nob = strnlen(name, IFNAMSIZ); + if (nob == IFNAMSIZ) { + CERROR("Interface name %s too long\n", name); + return -EINVAL; + } + + CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); + + strcpy(ifr.ifr_name, name); + rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); + + if (rc != 0) { + CERROR("Can't get flags for interface %s\n", name); + return rc; + } + + if ((ifr.ifr_flags & IFF_UP) == 0) { + CDEBUG(D_NET, "Interface %s down\n", name); + *up = 0; + *ip = *mask = 0; + return 0; + } + + *up = 1; + + strcpy(ifr.ifr_name, name); + ifr.ifr_addr.sa_family = AF_INET; + rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); + + if (rc != 0) { + CERROR("Can't get IP address for interface %s\n", name); + return rc; + } + + val = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; + *ip = ntohl(val); + + strcpy(ifr.ifr_name, name); + ifr.ifr_addr.sa_family = AF_INET; + rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); + + if (rc != 0) { + CERROR("Can't get netmask for interface %s\n", name); + return rc; + } + + val = ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr; + *mask = ntohl(val); + + return 0; +} + +EXPORT_SYMBOL(libcfs_ipif_query); + +int +libcfs_ipif_enumerate (char ***namesp) +{ + /* Allocate and fill in 'names', returning # interfaces/error */ + char **names; + int toobig; + int nalloc; + int nfound; + struct ifreq *ifr; + struct ifconf ifc; + int rc; + int nob; + int i; + + + nalloc = 16; /* first guess at max interfaces */ + toobig = 0; + for (;;) { + if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { + toobig = 1; + nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); + CWARN("Too many interfaces: only enumerating first %d\n", + nalloc); + } + + LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr)); + if (ifr == NULL) { + CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc); + rc = -ENOMEM; + goto out0; + } + + ifc.ifc_buf = (char *)ifr; + ifc.ifc_len = nalloc * sizeof(*ifr); + + rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); + + if (rc < 0) { + CERROR ("Error %d enumerating interfaces\n", rc); + goto out1; + } + + LASSERT (rc == 0); + + nfound = ifc.ifc_len/sizeof(*ifr); + LASSERT (nfound <= nalloc); + + if (nfound < nalloc || toobig) + break; + + LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); + nalloc *= 2; + } + + if (nfound == 0) + goto out1; + + LIBCFS_ALLOC(names, nfound * sizeof(*names)); + if (names == NULL) { + rc = -ENOMEM; + goto out1; + } + + for (i = 0; i < nfound; i++) { + + nob = strnlen (ifr[i].ifr_name, IFNAMSIZ); + if (nob == IFNAMSIZ) { + /* no space for terminating NULL */ + CERROR("interface name %.*s too long (%d max)\n", + nob, ifr[i].ifr_name, IFNAMSIZ); + rc = -ENAMETOOLONG; + goto out2; + } + + LIBCFS_ALLOC(names[i], IFNAMSIZ); + if (names[i] == NULL) { + rc = -ENOMEM; + goto out2; + } + + memcpy(names[i], ifr[i].ifr_name, nob); + names[i][nob] = 0; + } + + *namesp = names; + rc = nfound; + + out2: + if (rc < 0) + libcfs_ipif_free_enumeration(names, nfound); + out1: + LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); + out0: + return rc; +} + +EXPORT_SYMBOL(libcfs_ipif_enumerate); + +void +libcfs_ipif_free_enumeration (char **names, int n) +{ + int i; + + LASSERT (n > 0); + + for (i = 0; i < n && names[i] != NULL; i++) + LIBCFS_FREE(names[i], IFNAMSIZ); + + LIBCFS_FREE(names, n * sizeof(*names)); +} + +EXPORT_SYMBOL(libcfs_ipif_free_enumeration); + +int +libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +{ + int rc; + long ticks = timeout * HZ; + unsigned long then; + struct timeval tv; + + LASSERT (nob > 0); + /* Caller may pass a zero timeout if she thinks the socket buffer is + * empty enough to take the whole message immediately */ + + for (;;) { + struct kvec iov = { + .iov_base = buffer, + .iov_len = nob + }; + struct msghdr msg = { + .msg_flags = (timeout == 0) ? MSG_DONTWAIT : 0 + }; + + if (timeout != 0) { + /* Set send timeout to remaining time */ + tv = (struct timeval) { + .tv_sec = ticks / HZ, + .tv_usec = ((ticks % HZ) * 1000000) / HZ + }; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, + (char *)&tv, sizeof(tv)); + if (rc != 0) { + CERROR("Can't set socket send timeout %ld.%06d: %d\n", + (long)tv.tv_sec, (int)tv.tv_usec, rc); + return rc; + } + } + + then = jiffies; + rc = kernel_sendmsg(sock, &msg, &iov, 1, nob); + ticks -= jiffies - then; + + if (rc == nob) + return 0; + + if (rc < 0) + return rc; + + if (rc == 0) { + CERROR ("Unexpected zero rc\n"); + return -ECONNABORTED; + } + + if (ticks <= 0) + return -EAGAIN; + + buffer = ((char *)buffer) + rc; + nob -= rc; + } + + return 0; +} +EXPORT_SYMBOL(libcfs_sock_write); + +int +libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +{ + int rc; + long ticks = timeout * HZ; + unsigned long then; + struct timeval tv; + + LASSERT (nob > 0); + LASSERT (ticks > 0); + + for (;;) { + struct kvec iov = { + .iov_base = buffer, + .iov_len = nob + }; + struct msghdr msg = { + .msg_flags = 0 + }; + + /* Set receive timeout to remaining time */ + tv = (struct timeval) { + .tv_sec = ticks / HZ, + .tv_usec = ((ticks % HZ) * 1000000) / HZ + }; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, + (char *)&tv, sizeof(tv)); + if (rc != 0) { + CERROR("Can't set socket recv timeout %ld.%06d: %d\n", + (long)tv.tv_sec, (int)tv.tv_usec, rc); + return rc; + } + + then = jiffies; + rc = kernel_recvmsg(sock, &msg, &iov, 1, nob, 0); + ticks -= jiffies - then; + + if (rc < 0) + return rc; + + if (rc == 0) + return -ECONNRESET; + + buffer = ((char *)buffer) + rc; + nob -= rc; + + if (nob == 0) + return 0; + + if (ticks <= 0) + return -ETIMEDOUT; + } +} + +EXPORT_SYMBOL(libcfs_sock_read); + +static int +libcfs_sock_create (struct socket **sockp, int *fatal, + __u32 local_ip, int local_port) +{ + struct sockaddr_in locaddr; + struct socket *sock; + int rc; + int option; + + /* All errors are fatal except bind failure if the port is in use */ + *fatal = 1; + + rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + *sockp = sock; + if (rc != 0) { + CERROR ("Can't create socket: %d\n", rc); + return rc; + } + + option = 1; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + (char *)&option, sizeof (option)); + if (rc != 0) { + CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); + goto failed; + } + + if (local_ip != 0 || local_port != 0) { + memset(&locaddr, 0, sizeof(locaddr)); + locaddr.sin_family = AF_INET; + locaddr.sin_port = htons(local_port); + locaddr.sin_addr.s_addr = (local_ip == 0) ? + INADDR_ANY : htonl(local_ip); + + rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr, + sizeof(locaddr)); + if (rc == -EADDRINUSE) { + CDEBUG(D_NET, "Port %d already in use\n", local_port); + *fatal = 0; + goto failed; + } + if (rc != 0) { + CERROR("Error trying to bind to port %d: %d\n", + local_port, rc); + goto failed; + } + } + + return 0; + + failed: + sock_release(sock); + return rc; +} + +int +libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +{ + int option; + int rc; + + if (txbufsize != 0) { + option = txbufsize; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, + (char *)&option, sizeof (option)); + if (rc != 0) { + CERROR ("Can't set send buffer %d: %d\n", + option, rc); + return rc; + } + } + + if (rxbufsize != 0) { + option = rxbufsize; + rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, + (char *)&option, sizeof (option)); + if (rc != 0) { + CERROR ("Can't set receive buffer %d: %d\n", + option, rc); + return rc; + } + } + + return 0; +} + +EXPORT_SYMBOL(libcfs_sock_setbuf); + +int +libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) +{ + struct sockaddr_in sin; + int len = sizeof (sin); + int rc; + + rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, + remote ? 2 : 0); + if (rc != 0) { + CERROR ("Error %d getting sock %s IP/port\n", + rc, remote ? "peer" : "local"); + return rc; + } + + if (ip != NULL) + *ip = ntohl (sin.sin_addr.s_addr); + + if (port != NULL) + *port = ntohs (sin.sin_port); + + return 0; +} + +EXPORT_SYMBOL(libcfs_sock_getaddr); + +int +libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +{ + + if (txbufsize != NULL) { + *txbufsize = sock->sk->sk_sndbuf; + } + + if (rxbufsize != NULL) { + *rxbufsize = sock->sk->sk_rcvbuf; + } + + return 0; +} + +EXPORT_SYMBOL(libcfs_sock_getbuf); + +int +libcfs_sock_listen (struct socket **sockp, + __u32 local_ip, int local_port, int backlog) +{ + int fatal; + int rc; + + rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); + if (rc != 0) { + if (!fatal) + CERROR("Can't create socket: port %d already in use\n", + local_port); + return rc; + } + + rc = (*sockp)->ops->listen(*sockp, backlog); + if (rc == 0) + return 0; + + CERROR("Can't set listen backlog %d: %d\n", backlog, rc); + sock_release(*sockp); + return rc; +} + +EXPORT_SYMBOL(libcfs_sock_listen); + +int +libcfs_sock_accept (struct socket **newsockp, struct socket *sock) +{ + wait_queue_t wait; + struct socket *newsock; + int rc; + + init_waitqueue_entry(&wait, current); + + /* XXX this should add a ref to sock->ops->owner, if + * TCP could be a module */ + rc = sock_create_lite(PF_PACKET, sock->type, IPPROTO_TCP, &newsock); + if (rc) { + CERROR("Can't allocate socket\n"); + return rc; + } + + newsock->ops = sock->ops; + + rc = sock->ops->accept(sock, newsock, O_NONBLOCK); + if (rc == -EAGAIN) { + /* Nothing ready, so wait for activity */ + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(sk_sleep(sock->sk), &wait); + schedule(); + remove_wait_queue(sk_sleep(sock->sk), &wait); + set_current_state(TASK_RUNNING); + rc = sock->ops->accept(sock, newsock, O_NONBLOCK); + } + + if (rc != 0) + goto failed; + + *newsockp = newsock; + return 0; + + failed: + sock_release(newsock); + return rc; +} + +EXPORT_SYMBOL(libcfs_sock_accept); + +void +libcfs_sock_abort_accept (struct socket *sock) +{ + wake_up_all(sk_sleep(sock->sk)); +} + +EXPORT_SYMBOL(libcfs_sock_abort_accept); + +int +libcfs_sock_connect (struct socket **sockp, int *fatal, + __u32 local_ip, int local_port, + __u32 peer_ip, int peer_port) +{ + struct sockaddr_in srvaddr; + int rc; + + rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); + if (rc != 0) + return rc; + + memset (&srvaddr, 0, sizeof (srvaddr)); + srvaddr.sin_family = AF_INET; + srvaddr.sin_port = htons(peer_port); + srvaddr.sin_addr.s_addr = htonl(peer_ip); + + rc = (*sockp)->ops->connect(*sockp, + (struct sockaddr *)&srvaddr, sizeof(srvaddr), + 0); + if (rc == 0) + return 0; + + /* EADDRNOTAVAIL probably means we're already connected to the same + * peer/port on the same local port on a differently typed + * connection. Let our caller retry with a different local + * port... */ + *fatal = !(rc == -EADDRNOTAVAIL); + + CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET, + "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, + &local_ip, local_port, &peer_ip, peer_port); + + sock_release(*sockp); + return rc; +} + +EXPORT_SYMBOL(libcfs_sock_connect); + +void +libcfs_sock_release (struct socket *sock) +{ + sock_release(sock); +} + +EXPORT_SYMBOL(libcfs_sock_release); diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile b/drivers/staging/lustre/lustre/libcfs/Makefile index fabdd3e..ec98f44 100644 --- a/drivers/staging/lustre/lustre/libcfs/Makefile +++ b/drivers/staging/lustre/lustre/libcfs/Makefile @@ -2,7 +2,6 @@ obj-$(CONFIG_LUSTRE_FS) += libcfs.o libcfs-linux-objs := linux-tracefile.o linux-debug.o libcfs-linux-objs += linux-prim.o linux-cpu.o -libcfs-linux-objs += linux-tcpip.o libcfs-linux-objs += linux-curproc.o libcfs-linux-objs += linux-module.o libcfs-linux-objs += linux-crypto.o diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted file mode 100644 index f2462e7..0000000 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ -#define DEBUG_SUBSYSTEM S_LNET - -#include "../../../include/linux/libcfs/libcfs.h" - -#include -#include -#include -/* For sys_open & sys_close */ -#include - -static int -libcfs_sock_ioctl(int cmd, unsigned long arg) -{ - mm_segment_t oldmm = get_fs(); - struct socket *sock; - int rc; - struct file *sock_filp; - - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); - if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); - return rc; - } - - sock_filp = sock_alloc_file(sock, 0, NULL); - if (IS_ERR(sock_filp)) { - sock_release(sock); - rc = PTR_ERR(sock_filp); - goto out; - } - - set_fs(KERNEL_DS); - if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); - set_fs(oldmm); - - fput(sock_filp); -out: - return rc; -} - -int -libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) -{ - struct ifreq ifr; - int nob; - int rc; - __u32 val; - - nob = strnlen(name, IFNAMSIZ); - if (nob == IFNAMSIZ) { - CERROR("Interface name %s too long\n", name); - return -EINVAL; - } - - CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); - - strcpy(ifr.ifr_name, name); - rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); - - if (rc != 0) { - CERROR("Can't get flags for interface %s\n", name); - return rc; - } - - if ((ifr.ifr_flags & IFF_UP) == 0) { - CDEBUG(D_NET, "Interface %s down\n", name); - *up = 0; - *ip = *mask = 0; - return 0; - } - - *up = 1; - - strcpy(ifr.ifr_name, name); - ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); - - if (rc != 0) { - CERROR("Can't get IP address for interface %s\n", name); - return rc; - } - - val = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; - *ip = ntohl(val); - - strcpy(ifr.ifr_name, name); - ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); - - if (rc != 0) { - CERROR("Can't get netmask for interface %s\n", name); - return rc; - } - - val = ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr; - *mask = ntohl(val); - - return 0; -} - -EXPORT_SYMBOL(libcfs_ipif_query); - -int -libcfs_ipif_enumerate (char ***namesp) -{ - /* Allocate and fill in 'names', returning # interfaces/error */ - char **names; - int toobig; - int nalloc; - int nfound; - struct ifreq *ifr; - struct ifconf ifc; - int rc; - int nob; - int i; - - - nalloc = 16; /* first guess at max interfaces */ - toobig = 0; - for (;;) { - if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { - toobig = 1; - nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); - CWARN("Too many interfaces: only enumerating first %d\n", - nalloc); - } - - LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr)); - if (ifr == NULL) { - CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc); - rc = -ENOMEM; - goto out0; - } - - ifc.ifc_buf = (char *)ifr; - ifc.ifc_len = nalloc * sizeof(*ifr); - - rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); - - if (rc < 0) { - CERROR ("Error %d enumerating interfaces\n", rc); - goto out1; - } - - LASSERT (rc == 0); - - nfound = ifc.ifc_len/sizeof(*ifr); - LASSERT (nfound <= nalloc); - - if (nfound < nalloc || toobig) - break; - - LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); - nalloc *= 2; - } - - if (nfound == 0) - goto out1; - - LIBCFS_ALLOC(names, nfound * sizeof(*names)); - if (names == NULL) { - rc = -ENOMEM; - goto out1; - } - - for (i = 0; i < nfound; i++) { - - nob = strnlen (ifr[i].ifr_name, IFNAMSIZ); - if (nob == IFNAMSIZ) { - /* no space for terminating NULL */ - CERROR("interface name %.*s too long (%d max)\n", - nob, ifr[i].ifr_name, IFNAMSIZ); - rc = -ENAMETOOLONG; - goto out2; - } - - LIBCFS_ALLOC(names[i], IFNAMSIZ); - if (names[i] == NULL) { - rc = -ENOMEM; - goto out2; - } - - memcpy(names[i], ifr[i].ifr_name, nob); - names[i][nob] = 0; - } - - *namesp = names; - rc = nfound; - - out2: - if (rc < 0) - libcfs_ipif_free_enumeration(names, nfound); - out1: - LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); - out0: - return rc; -} - -EXPORT_SYMBOL(libcfs_ipif_enumerate); - -void -libcfs_ipif_free_enumeration (char **names, int n) -{ - int i; - - LASSERT (n > 0); - - for (i = 0; i < n && names[i] != NULL; i++) - LIBCFS_FREE(names[i], IFNAMSIZ); - - LIBCFS_FREE(names, n * sizeof(*names)); -} - -EXPORT_SYMBOL(libcfs_ipif_free_enumeration); - -int -libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) -{ - int rc; - long ticks = timeout * HZ; - unsigned long then; - struct timeval tv; - - LASSERT (nob > 0); - /* Caller may pass a zero timeout if she thinks the socket buffer is - * empty enough to take the whole message immediately */ - - for (;;) { - struct kvec iov = { - .iov_base = buffer, - .iov_len = nob - }; - struct msghdr msg = { - .msg_flags = (timeout == 0) ? MSG_DONTWAIT : 0 - }; - - if (timeout != 0) { - /* Set send timeout to remaining time */ - tv = (struct timeval) { - .tv_sec = ticks / HZ, - .tv_usec = ((ticks % HZ) * 1000000) / HZ - }; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, - (char *)&tv, sizeof(tv)); - if (rc != 0) { - CERROR("Can't set socket send timeout %ld.%06d: %d\n", - (long)tv.tv_sec, (int)tv.tv_usec, rc); - return rc; - } - } - - then = jiffies; - rc = kernel_sendmsg(sock, &msg, &iov, 1, nob); - ticks -= jiffies - then; - - if (rc == nob) - return 0; - - if (rc < 0) - return rc; - - if (rc == 0) { - CERROR ("Unexpected zero rc\n"); - return -ECONNABORTED; - } - - if (ticks <= 0) - return -EAGAIN; - - buffer = ((char *)buffer) + rc; - nob -= rc; - } - - return 0; -} -EXPORT_SYMBOL(libcfs_sock_write); - -int -libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) -{ - int rc; - long ticks = timeout * HZ; - unsigned long then; - struct timeval tv; - - LASSERT (nob > 0); - LASSERT (ticks > 0); - - for (;;) { - struct kvec iov = { - .iov_base = buffer, - .iov_len = nob - }; - struct msghdr msg = { - .msg_flags = 0 - }; - - /* Set receive timeout to remaining time */ - tv = (struct timeval) { - .tv_sec = ticks / HZ, - .tv_usec = ((ticks % HZ) * 1000000) / HZ - }; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, - (char *)&tv, sizeof(tv)); - if (rc != 0) { - CERROR("Can't set socket recv timeout %ld.%06d: %d\n", - (long)tv.tv_sec, (int)tv.tv_usec, rc); - return rc; - } - - then = jiffies; - rc = kernel_recvmsg(sock, &msg, &iov, 1, nob, 0); - ticks -= jiffies - then; - - if (rc < 0) - return rc; - - if (rc == 0) - return -ECONNRESET; - - buffer = ((char *)buffer) + rc; - nob -= rc; - - if (nob == 0) - return 0; - - if (ticks <= 0) - return -ETIMEDOUT; - } -} - -EXPORT_SYMBOL(libcfs_sock_read); - -static int -libcfs_sock_create (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port) -{ - struct sockaddr_in locaddr; - struct socket *sock; - int rc; - int option; - - /* All errors are fatal except bind failure if the port is in use */ - *fatal = 1; - - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); - *sockp = sock; - if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); - return rc; - } - - option = 1; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *)&option, sizeof (option)); - if (rc != 0) { - CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); - goto failed; - } - - if (local_ip != 0 || local_port != 0) { - memset(&locaddr, 0, sizeof(locaddr)); - locaddr.sin_family = AF_INET; - locaddr.sin_port = htons(local_port); - locaddr.sin_addr.s_addr = (local_ip == 0) ? - INADDR_ANY : htonl(local_ip); - - rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr, - sizeof(locaddr)); - if (rc == -EADDRINUSE) { - CDEBUG(D_NET, "Port %d already in use\n", local_port); - *fatal = 0; - goto failed; - } - if (rc != 0) { - CERROR("Error trying to bind to port %d: %d\n", - local_port, rc); - goto failed; - } - } - - return 0; - - failed: - sock_release(sock); - return rc; -} - -int -libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) -{ - int option; - int rc; - - if (txbufsize != 0) { - option = txbufsize; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, - (char *)&option, sizeof (option)); - if (rc != 0) { - CERROR ("Can't set send buffer %d: %d\n", - option, rc); - return rc; - } - } - - if (rxbufsize != 0) { - option = rxbufsize; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (char *)&option, sizeof (option)); - if (rc != 0) { - CERROR ("Can't set receive buffer %d: %d\n", - option, rc); - return rc; - } - } - - return 0; -} - -EXPORT_SYMBOL(libcfs_sock_setbuf); - -int -libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) -{ - struct sockaddr_in sin; - int len = sizeof (sin); - int rc; - - rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, - remote ? 2 : 0); - if (rc != 0) { - CERROR ("Error %d getting sock %s IP/port\n", - rc, remote ? "peer" : "local"); - return rc; - } - - if (ip != NULL) - *ip = ntohl (sin.sin_addr.s_addr); - - if (port != NULL) - *port = ntohs (sin.sin_port); - - return 0; -} - -EXPORT_SYMBOL(libcfs_sock_getaddr); - -int -libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) -{ - - if (txbufsize != NULL) { - *txbufsize = sock->sk->sk_sndbuf; - } - - if (rxbufsize != NULL) { - *rxbufsize = sock->sk->sk_rcvbuf; - } - - return 0; -} - -EXPORT_SYMBOL(libcfs_sock_getbuf); - -int -libcfs_sock_listen (struct socket **sockp, - __u32 local_ip, int local_port, int backlog) -{ - int fatal; - int rc; - - rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); - if (rc != 0) { - if (!fatal) - CERROR("Can't create socket: port %d already in use\n", - local_port); - return rc; - } - - rc = (*sockp)->ops->listen(*sockp, backlog); - if (rc == 0) - return 0; - - CERROR("Can't set listen backlog %d: %d\n", backlog, rc); - sock_release(*sockp); - return rc; -} - -EXPORT_SYMBOL(libcfs_sock_listen); - -int -libcfs_sock_accept (struct socket **newsockp, struct socket *sock) -{ - wait_queue_t wait; - struct socket *newsock; - int rc; - - init_waitqueue_entry(&wait, current); - - /* XXX this should add a ref to sock->ops->owner, if - * TCP could be a module */ - rc = sock_create_lite(PF_PACKET, sock->type, IPPROTO_TCP, &newsock); - if (rc) { - CERROR("Can't allocate socket\n"); - return rc; - } - - newsock->ops = sock->ops; - - rc = sock->ops->accept(sock, newsock, O_NONBLOCK); - if (rc == -EAGAIN) { - /* Nothing ready, so wait for activity */ - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(sk_sleep(sock->sk), &wait); - schedule(); - remove_wait_queue(sk_sleep(sock->sk), &wait); - set_current_state(TASK_RUNNING); - rc = sock->ops->accept(sock, newsock, O_NONBLOCK); - } - - if (rc != 0) - goto failed; - - *newsockp = newsock; - return 0; - - failed: - sock_release(newsock); - return rc; -} - -EXPORT_SYMBOL(libcfs_sock_accept); - -void -libcfs_sock_abort_accept (struct socket *sock) -{ - wake_up_all(sk_sleep(sock->sk)); -} - -EXPORT_SYMBOL(libcfs_sock_abort_accept); - -int -libcfs_sock_connect (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port) -{ - struct sockaddr_in srvaddr; - int rc; - - rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); - if (rc != 0) - return rc; - - memset (&srvaddr, 0, sizeof (srvaddr)); - srvaddr.sin_family = AF_INET; - srvaddr.sin_port = htons(peer_port); - srvaddr.sin_addr.s_addr = htonl(peer_ip); - - rc = (*sockp)->ops->connect(*sockp, - (struct sockaddr *)&srvaddr, sizeof(srvaddr), - 0); - if (rc == 0) - return 0; - - /* EADDRNOTAVAIL probably means we're already connected to the same - * peer/port on the same local port on a differently typed - * connection. Let our caller retry with a different local - * port... */ - *fatal = !(rc == -EADDRNOTAVAIL); - - CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET, - "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, - &local_ip, local_port, &peer_ip, peer_port); - - sock_release(*sockp); - return rc; -} - -EXPORT_SYMBOL(libcfs_sock_connect); - -void -libcfs_sock_release (struct socket *sock) -{ - sock_release(sock); -} - -EXPORT_SYMBOL(libcfs_sock_release); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 19:57:09 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:09 -0400 Subject: [lustre-devel] [PATCH v4 3/7] staging:lustre: remove useless libcfs_sock_abort_accept In-Reply-To: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433361433-24976-4-git-send-email-jsimmons@infradead.org> Another one of those silly one line wrappers which is not needed. Replace libcfs_sock_abort_accept wrapper with a direct call to wake_up_all on the lnet_acceptor_state sock. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - drivers/staging/lustre/lnet/lnet/acceptor.c | 4 ++-- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index f469333..457ce9a 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -71,7 +71,6 @@ int libcfs_ipif_enumerate(char ***names); void libcfs_ipif_free_enumeration(char **names, int n); int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); int libcfs_sock_accept(struct socket **newsockp, struct socket *sock); -void libcfs_sock_abort_accept(struct socket *sock); int libcfs_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, int local_port, __u32 peer_ip, int peer_port); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index bc212f5..5187e65 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -377,7 +377,7 @@ lnet_acceptor(void *arg) continue; } - /* maybe we're waken up with libcfs_sock_abort_accept() */ + /* maybe the LNet acceptor thread has been waken */ if (lnet_acceptor_state.pta_shutdown) { sock_release(newsock); break; @@ -493,7 +493,7 @@ lnet_acceptor_stop(void) return; lnet_acceptor_state.pta_shutdown = 1; - libcfs_sock_abort_accept(lnet_acceptor_state.pta_sock); + wake_up_all(sk_sleep(lnet_acceptor_state.pta_sock->sk)); /* block until acceptor signals exit */ wait_for_completion(&lnet_acceptor_state.pta_signal); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 259db61..bb8d9c2 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -568,14 +568,6 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) EXPORT_SYMBOL(libcfs_sock_accept); -void -libcfs_sock_abort_accept (struct socket *sock) -{ - wake_up_all(sk_sleep(sock->sk)); -} - -EXPORT_SYMBOL(libcfs_sock_abort_accept); - int libcfs_sock_connect (struct socket **sockp, int *fatal, __u32 local_ip, int local_port, -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 19:57:10 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:10 -0400 Subject: [lustre-devel] [PATCH v4 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433361433-24976-5-git-send-email-jsimmons@infradead.org> With all the TCPIP handling done in the lnet layer we should rename all the functions with the prefix lnet_*. One other change done was changing the remove argument of lnet_sock_getaddr from a int to a bool. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 15 ----- .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 +++++ .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 11 ++-- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 ++--- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/acceptor.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/config.c | 21 +++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 66 +++++++++---------- 10 files changed, 110 insertions(+), 128 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 457ce9a..5dd9cdf 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -65,21 +65,6 @@ static inline int __is_po2(unsigned long long val) int libcfs_arch_init(void); void libcfs_arch_cleanup(void); -/* libcfs tcpip */ -int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); -int libcfs_ipif_enumerate(char ***names); -void libcfs_ipif_free_enumeration(char **names, int n); -int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); -int libcfs_sock_accept(struct socket **newsockp, struct socket *sock); -int libcfs_sock_connect(struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port); -int libcfs_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); -int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); -int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port); -int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout); -int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout); - /* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512 #define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023 diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index d84aa9a..ff07703 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -844,6 +844,22 @@ int lnet_acceptor_port(void); int lnet_acceptor_start(void); void lnet_acceptor_stop(void); +int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); +int lnet_ipif_enumerate(char ***names); +void lnet_ipif_free_enumeration(char **names, int n); +int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); +int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); +int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port); +int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout); +int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout); + +int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); +int lnet_sock_accept(struct socket **newsockp, struct socket *sock); +int lnet_sock_connect(struct socket **sockp, int *fatal, + __u32 local_ip, int local_port, + __u32 peer_ip, int peer_port); +void libcfs_sock_release(struct socket *sock); + void lnet_get_tunables(void); int lnet_peers_start_down(void); int lnet_peer_buffer_credits(lnet_ni_t *ni); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index a57c5c3..060b739 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2617,7 +2617,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname) int up; int rc; - rc = libcfs_ipif_query(ifname, &up, &ip, &netmask); + rc = lnet_ipif_query(ifname, &up, &ip, &netmask); if (rc != 0) { CERROR("Can't query IPoIB interface %s: %d\n", ifname, rc); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 38e831f..ee5cf35 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock) __u32 peer_ip; int peer_port; - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); LASSERT(rc == 0); /* we succeeded before */ LIBCFS_ALLOC(cr, sizeof(*cr)); @@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) int rc; int n; - n = libcfs_ipif_enumerate(&names); + n = lnet_ipif_enumerate(&names); if (n <= 0) { CERROR("Can't enumerate interfaces: %d\n", n); return n; @@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) if (!strcmp(names[i], "lo")) /* skip the loopback IF */ continue; - rc = libcfs_ipif_query(names[i], &up, &ip, &mask); + rc = lnet_ipif_query(names[i], &up, &ip, &mask); if (rc != 0) { CWARN("Can't get interface %s info: %d\n", names[i], rc); @@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) j++; } - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); if (j == 0) CERROR("Can't find any usable interfaces\n"); @@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni) if (ni->ni_interfaces[i] == NULL) break; - rc = libcfs_ipif_query( - ni->ni_interfaces[i], &up, + rc = lnet_ipif_query(ni->ni_interfaces[i], &up, &net->ksnn_interfaces[i].ksni_ipaddr, &net->ksnn_interfaces[i].ksni_netmask); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index a1a4ac0..fe2a83a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, timeout = active ? *ksocknal_tunables.ksnd_timeout : lnet_acceptor_timeout(); - rc = libcfs_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); + rc = lnet_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, return -EPROTO; } - rc = libcfs_sock_read(sock, &hello->kshm_version, - sizeof(hello->kshm_version), timeout); + rc = lnet_sock_read(sock, &hello->kshm_version, + sizeof(hello->kshm_version), timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index caeb347..34c6a72 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -39,9 +39,8 @@ int ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) { - int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1, - &conn->ksnc_ipaddr, - &conn->ksnc_port); + int rc = lnet_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr, + &conn->ksnc_port); /* Didn't need the {get,put}connsock dance to deref ksnc_sock... */ LASSERT(!conn->ksnc_closing); @@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) return rc; } - rc = libcfs_sock_getaddr(conn->ksnc_sock, 0, - &conn->ksnc_myipaddr, NULL); + rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL); if (rc != 0) { CERROR("Error %d getting sock local IP\n", rc); return rc; @@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int * return -ESHUTDOWN; } - rc = libcfs_sock_getbuf(sock, txmem, rxmem); + rc = lnet_sock_getbuf(sock, txmem, rxmem); if (rc == 0) { len = sizeof(*nagle); rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY, @@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock) } } - rc = libcfs_sock_setbuf(sock, - *ksocknal_tunables.ksnd_tx_buffer_size, - *ksocknal_tunables.ksnd_rx_buffer_size); + rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size, + *ksocknal_tunables.ksnd_rx_buffer_size); if (rc != 0) { CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", *ksocknal_tunables.ksnd_tx_buffer_size, diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index 1938d6a..986bce4 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -495,9 +495,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype); hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation); - rc = libcfs_sock_write(sock, hdr, sizeof(*hdr), - lnet_acceptor_timeout()); - + rc = lnet_sock_write(sock, hdr, sizeof(*hdr), lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", rc, &conn->ksnc_ipaddr, conn->ksnc_port); @@ -511,9 +509,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hello->kshm_ips[i] = __cpu_to_le32 (hello->kshm_ips[i]); } - rc = libcfs_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), - lnet_acceptor_timeout()); + rc = lnet_sock_write(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips, @@ -544,9 +542,8 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) LNET_UNLOCK(); } - rc = libcfs_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), - lnet_acceptor_timeout()); - + rc = lnet_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", rc, &conn->ksnc_ipaddr, conn->ksnc_port); @@ -556,9 +553,9 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) if (hello->kshm_nips == 0) return 0; - rc = libcfs_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), - lnet_acceptor_timeout()); + rc = lnet_sock_write(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips, @@ -583,9 +580,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, return -ENOMEM; } - rc = libcfs_sock_read(sock, &hdr->src_nid, - sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), - timeout); + rc = lnet_sock_read(sock, &hdr->src_nid, + sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), + timeout); if (rc != 0) { CERROR("Error %d reading rest of HELLO hdr from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -619,8 +616,8 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, if (hello->kshm_nips == 0) goto out; - rc = libcfs_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + rc = lnet_sock_read(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), timeout); if (rc != 0) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -656,10 +653,10 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout else conn->ksnc_flip = 1; - rc = libcfs_sock_read(sock, &hello->kshm_src_nid, - offsetof(ksock_hello_msg_t, kshm_ips) - - offsetof(ksock_hello_msg_t, kshm_src_nid), - timeout); + rc = lnet_sock_read(sock, &hello->kshm_src_nid, + offsetof(ksock_hello_msg_t, kshm_ips) - + offsetof(ksock_hello_msg_t, kshm_src_nid), + timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -687,8 +684,8 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout if (hello->kshm_nips == 0) return 0; - rc = libcfs_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + rc = lnet_sock_read(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), timeout); if (rc != 0) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 5187e65..1dc7c8a 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -155,9 +155,8 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, --port) { /* Iterate through reserved ports. */ - rc = libcfs_sock_connect(&sock, &fatal, - local_ip, port, - peer_ip, peer_port); + rc = lnet_sock_connect(&sock, &fatal, local_ip, port, peer_ip, + peer_port); if (rc != 0) { if (fatal) goto failed; @@ -184,8 +183,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, lnet_net_unlock(LNET_LOCK_EX); } - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); if (rc != 0) goto failed_sock; @@ -220,7 +218,7 @@ lnet_accept(struct socket *sock, __u32 magic) LASSERT(sizeof(cr) <= 16); /* not too big for the stack */ - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); LASSERT(rc == 0); /* we succeeded before */ if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) { @@ -234,8 +232,8 @@ lnet_accept(struct socket *sock, __u32 magic) memset(&cr, 0, sizeof(cr)); cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); + rc = lnet_sock_write(sock, &cr, sizeof(cr), + accept_timeout); if (rc != 0) CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n", @@ -257,9 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic) flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC); - rc = libcfs_sock_read(sock, &cr.acr_version, - sizeof(cr.acr_version), - accept_timeout); + rc = lnet_sock_read(sock, &cr.acr_version, sizeof(cr.acr_version), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request version from %pI4h\n", rc, &peer_ip); @@ -280,19 +277,17 @@ lnet_accept(struct socket *sock, __u32 magic) cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); - + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); if (rc != 0) CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n", peer_version, &peer_ip, rc); return -EPROTO; } - rc = libcfs_sock_read(sock, &cr.acr_nid, - sizeof(cr) - - offsetof(lnet_acceptor_connreq_t, acr_nid), - accept_timeout); + rc = lnet_sock_read(sock, &cr.acr_nid, + sizeof(cr) - + offsetof(lnet_acceptor_connreq_t, acr_nid), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request from %pI4h\n", rc, &peer_ip); @@ -343,8 +338,8 @@ lnet_acceptor(void *arg) cfs_block_allsigs(); - rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock, - 0, accept_port, accept_backlog); + rc = lnet_sock_listen(&lnet_acceptor_state.pta_sock, 0, accept_port, + accept_backlog); if (rc != 0) { if (rc == -EADDRINUSE) LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n", @@ -367,7 +362,7 @@ lnet_acceptor(void *arg) while (!lnet_acceptor_state.pta_shutdown) { - rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock); + rc = lnet_sock_accept(&newsock, lnet_acceptor_state.pta_sock); if (rc != 0) { if (rc != -EAGAIN) { CWARN("Accept error %d: pausing...\n", rc); @@ -383,7 +378,7 @@ lnet_acceptor(void *arg) break; } - rc = libcfs_sock_getaddr(newsock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(newsock, 1, &peer_ip, &peer_port); if (rc != 0) { CERROR("Can't determine new connection's address\n"); goto failed; @@ -395,8 +390,8 @@ lnet_acceptor(void *arg) goto failed; } - rc = libcfs_sock_read(newsock, &magic, sizeof(magic), - accept_timeout); + rc = lnet_sock_read(newsock, &magic, sizeof(magic), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request from %pI4h\n", rc, &peer_ip); diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 70bc809..efbb74a 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) __u32 *ipaddrs2; int nip; char **ifnames; - int nif = libcfs_ipif_enumerate(&ifnames); + int nif = lnet_ipif_enumerate(&ifnames); int i; int rc; @@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs)); if (ipaddrs == NULL) { CERROR("Can't allocate ipaddrs[%d]\n", nif); - libcfs_ipif_free_enumeration(ifnames, nif); + lnet_ipif_free_enumeration(ifnames, nif); return -ENOMEM; } @@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) if (!strcmp(ifnames[i], "lo")) continue; - rc = libcfs_ipif_query(ifnames[i], &up, - &ipaddrs[nip], &netmask); + rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask); if (rc != 0) { CWARN("Can't query interface %s: %d\n", ifnames[i], rc); @@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) nip++; } - libcfs_ipif_free_enumeration(ifnames, nif); + lnet_ipif_free_enumeration(ifnames, nif); if (nip == nif) { *ipaddrsp = ipaddrs; @@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) return -EPERM; } - rc = libcfs_ipif_query(ni->ni_interfaces[0], - &up, &ip, &netmask); + rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask); if (rc != 0) { CERROR("Net %s can't query interface %s: %d\n", libcfs_net2str(net), ni->ni_interfaces[0], rc); @@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) return 0; } - n = libcfs_ipif_enumerate(&names); + n = lnet_ipif_enumerate(&names); if (n <= 0) { CERROR("Net %s can't enumerate interfaces: %d\n", libcfs_net2str(net), n); @@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) if (!strcmp(names[i], "lo")) /* skip the loopback IF */ continue; - rc = libcfs_ipif_query(names[i], &up, &ip, &netmask); - + rc = lnet_ipif_query(names[i], &up, &ip, &netmask); if (rc != 0) { CWARN("Net %s can't query interface %s: %d\n", libcfs_net2str(net), names[i], rc); @@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) continue; } - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); ni->ni_nid = LNET_MKNID(net, ip); return 0; } CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net)); - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); return -ENOENT; } EXPORT_SYMBOL(lnet_set_ip_niaddr); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index bb8d9c2..2e87168 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -45,7 +45,7 @@ #include static int -libcfs_sock_ioctl(int cmd, unsigned long arg) +lnet_sock_ioctl(int cmd, unsigned long arg) { mm_segment_t oldmm = get_fs(); struct socket *sock; @@ -76,7 +76,7 @@ out: } int -libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) { struct ifreq ifr; int nob; @@ -92,8 +92,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); strcpy(ifr.ifr_name, name); - rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get flags for interface %s\n", name); return rc; @@ -110,8 +109,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) strcpy(ifr.ifr_name, name); ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get IP address for interface %s\n", name); return rc; @@ -122,8 +120,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) strcpy(ifr.ifr_name, name); ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get netmask for interface %s\n", name); return rc; @@ -135,10 +132,10 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return 0; } -EXPORT_SYMBOL(libcfs_ipif_query); +EXPORT_SYMBOL(lnet_ipif_query); int -libcfs_ipif_enumerate (char ***namesp) +lnet_ipif_enumerate (char ***namesp) { /* Allocate and fill in 'names', returning # interfaces/error */ char **names; @@ -172,8 +169,7 @@ libcfs_ipif_enumerate (char ***namesp) ifc.ifc_buf = (char *)ifr; ifc.ifc_len = nalloc * sizeof(*ifr); - rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); - + rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); if (rc < 0) { CERROR ("Error %d enumerating interfaces\n", rc); goto out1; @@ -226,17 +222,17 @@ libcfs_ipif_enumerate (char ***namesp) out2: if (rc < 0) - libcfs_ipif_free_enumeration(names, nfound); + lnet_ipif_free_enumeration(names, nfound); out1: LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); out0: return rc; } -EXPORT_SYMBOL(libcfs_ipif_enumerate); +EXPORT_SYMBOL(lnet_ipif_enumerate); void -libcfs_ipif_free_enumeration (char **names, int n) +lnet_ipif_free_enumeration (char **names, int n) { int i; @@ -248,10 +244,10 @@ libcfs_ipif_free_enumeration (char **names, int n) LIBCFS_FREE(names, n * sizeof(*names)); } -EXPORT_SYMBOL(libcfs_ipif_free_enumeration); +EXPORT_SYMBOL(lnet_ipif_free_enumeration); int -libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) { int rc; long ticks = timeout * HZ; @@ -310,10 +306,10 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) return 0; } -EXPORT_SYMBOL(libcfs_sock_write); +EXPORT_SYMBOL(lnet_sock_write); int -libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) { int rc; long ticks = timeout * HZ; @@ -366,10 +362,10 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) } } -EXPORT_SYMBOL(libcfs_sock_read); +EXPORT_SYMBOL(lnet_sock_read); static int -libcfs_sock_create (struct socket **sockp, int *fatal, +lnet_sock_create (struct socket **sockp, int *fatal, __u32 local_ip, int local_port) { struct sockaddr_in locaddr; @@ -424,7 +420,7 @@ libcfs_sock_create (struct socket **sockp, int *fatal, } int -libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) { int option; int rc; @@ -454,10 +450,10 @@ libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) return 0; } -EXPORT_SYMBOL(libcfs_sock_setbuf); +EXPORT_SYMBOL(lnet_sock_setbuf); int -libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) +lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) { struct sockaddr_in sin; int len = sizeof (sin); @@ -480,10 +476,10 @@ libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) return 0; } -EXPORT_SYMBOL(libcfs_sock_getaddr); +EXPORT_SYMBOL(lnet_sock_getaddr); int -libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) { if (txbufsize != NULL) { @@ -497,16 +493,16 @@ libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) return 0; } -EXPORT_SYMBOL(libcfs_sock_getbuf); +EXPORT_SYMBOL(lnet_sock_getbuf); int -libcfs_sock_listen (struct socket **sockp, +lnet_sock_listen (struct socket **sockp, __u32 local_ip, int local_port, int backlog) { int fatal; int rc; - rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); + rc = lnet_sock_create(sockp, &fatal, local_ip, local_port); if (rc != 0) { if (!fatal) CERROR("Can't create socket: port %d already in use\n", @@ -523,10 +519,10 @@ libcfs_sock_listen (struct socket **sockp, return rc; } -EXPORT_SYMBOL(libcfs_sock_listen); +EXPORT_SYMBOL(lnet_sock_listen); int -libcfs_sock_accept (struct socket **newsockp, struct socket *sock) +lnet_sock_accept (struct socket **newsockp, struct socket *sock) { wait_queue_t wait; struct socket *newsock; @@ -566,17 +562,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) return rc; } -EXPORT_SYMBOL(libcfs_sock_accept); +EXPORT_SYMBOL(lnet_sock_accept); int -libcfs_sock_connect (struct socket **sockp, int *fatal, +lnet_sock_connect (struct socket **sockp, int *fatal, __u32 local_ip, int local_port, __u32 peer_ip, int peer_port) { struct sockaddr_in srvaddr; int rc; - rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); + rc = lnet_sock_create(sockp, fatal, local_ip, local_port); if (rc != 0) return rc; @@ -605,4 +601,4 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, return rc; } -EXPORT_SYMBOL(libcfs_sock_connect); +EXPORT_SYMBOL(lnet_sock_connect); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 19:57:12 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:12 -0400 Subject: [lustre-devel] [PATCH v4 6/7] staging:lustre: style cleanups for lib-socket.c In-Reply-To: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433361433-24976-7-git-send-email-jsimmons@infradead.org> Handle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, etc. Signed-off-by: James Simmons --- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 207 +++++++++----------- 2 files changed, 96 insertions(+), 115 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index ee5cf35..4128a92 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1378,14 +1378,14 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, ksocknal_txlist_done(ni, &zombies, 1); ksocknal_peer_decref(peer); - failed_1: +failed_1: if (hello != NULL) LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t, kshm_ips[LNET_MAX_INTERFACES])); LIBCFS_FREE(conn, sizeof(*conn)); - failed_0: +failed_0: sock_release(sock); return rc; } diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 2d46a69..b126068 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -63,13 +63,13 @@ kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg) static int lnet_sock_ioctl(int cmd, unsigned long arg) { - struct file *sock_filp; - struct socket *sock; - int rc; + struct file *sock_filp; + struct socket *sock; + int rc; - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock); if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); + CERROR("Can't create socket: %d\n", rc); return rc; } @@ -88,12 +88,12 @@ out: } int -lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask) { - struct ifreq ifr; - int nob; - int rc; - __u32 val; + struct ifreq ifr; + int nob; + int rc; + __u32 val; nob = strnlen(name, IFNAMSIZ); if (nob == IFNAMSIZ) { @@ -101,7 +101,7 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return -EINVAL; } - CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); + CLASSERT(sizeof(ifr.ifr_name) >= IFNAMSIZ); strcpy(ifr.ifr_name, name); rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); @@ -116,7 +116,6 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) *ip = *mask = 0; return 0; } - *up = 1; strcpy(ifr.ifr_name, name); @@ -143,23 +142,21 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return 0; } - EXPORT_SYMBOL(lnet_ipif_query); int -lnet_ipif_enumerate (char ***namesp) +lnet_ipif_enumerate(char ***namesp) { /* Allocate and fill in 'names', returning # interfaces/error */ - char **names; - int toobig; - int nalloc; - int nfound; - struct ifreq *ifr; - struct ifconf ifc; - int rc; - int nob; - int i; - + char **names; + int toobig; + int nalloc; + int nfound; + struct ifreq *ifr; + struct ifconf ifc; + int rc; + int nob; + int i; nalloc = 16; /* first guess at max interfaces */ toobig = 0; @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp) if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { toobig = 1; nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); - CWARN("Too many interfaces: only enumerating first %d\n", - nalloc); + CWARN("Too many interfaces: only enumerating " + "first %d\n", nalloc); } LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr)); if (ifr == NULL) { - CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc); + CERROR("ENOMEM enumerating up to %d interfaces\n", + nalloc); rc = -ENOMEM; goto out0; } @@ -183,14 +181,14 @@ lnet_ipif_enumerate (char ***namesp) rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); if (rc < 0) { - CERROR ("Error %d enumerating interfaces\n", rc); + CERROR("Error %d enumerating interfaces\n", rc); goto out1; } - LASSERT (rc == 0); + LASSERT(rc == 0); nfound = ifc.ifc_len/sizeof(*ifr); - LASSERT (nfound <= nalloc); + LASSERT(nfound <= nalloc); if (nfound < nalloc || toobig) break; @@ -209,8 +207,7 @@ lnet_ipif_enumerate (char ***namesp) } for (i = 0; i < nfound; i++) { - - nob = strnlen (ifr[i].ifr_name, IFNAMSIZ); + nob = strnlen(ifr[i].ifr_name, IFNAMSIZ); if (nob == IFNAMSIZ) { /* no space for terminating NULL */ CERROR("interface name %.*s too long (%d max)\n", @@ -232,41 +229,39 @@ lnet_ipif_enumerate (char ***namesp) *namesp = names; rc = nfound; - out2: +out2: if (rc < 0) lnet_ipif_free_enumeration(names, nfound); - out1: +out1: LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); - out0: +out0: return rc; } - EXPORT_SYMBOL(lnet_ipif_enumerate); void -lnet_ipif_free_enumeration (char **names, int n) +lnet_ipif_free_enumeration(char **names, int n) { - int i; + int i; - LASSERT (n > 0); + LASSERT(n > 0); for (i = 0; i < n && names[i] != NULL; i++) LIBCFS_FREE(names[i], IFNAMSIZ); LIBCFS_FREE(names, n * sizeof(*names)); } - EXPORT_SYMBOL(lnet_ipif_free_enumeration); int -lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout) { - int rc; - long ticks = timeout * HZ; - unsigned long then; + int rc; + long ticks = timeout * HZ; + unsigned long then; struct timeval tv; - LASSERT (nob > 0); + LASSERT(nob > 0); /* Caller may pass a zero timeout if she thinks the socket buffer is * empty enough to take the whole message immediately */ @@ -286,7 +281,7 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) .tv_usec = ((ticks % HZ) * 1000000) / HZ }; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, - (char *)&tv, sizeof(tv)); + (char *)&tv, sizeof(tv)); if (rc != 0) { CERROR("Can't set socket send timeout %ld.%06d: %d\n", (long)tv.tv_sec, (int)tv.tv_usec, rc); @@ -305,7 +300,7 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) return rc; if (rc == 0) { - CERROR ("Unexpected zero rc\n"); + CERROR("Unexpected zero rc\n"); return -ECONNABORTED; } @@ -315,21 +310,20 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) buffer = ((char *)buffer) + rc; nob -= rc; } - return 0; } EXPORT_SYMBOL(lnet_sock_write); int -lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout) { - int rc; - long ticks = timeout * HZ; - unsigned long then; + int rc; + long ticks = timeout * HZ; + unsigned long then; struct timeval tv; - LASSERT (nob > 0); - LASSERT (ticks > 0); + LASSERT(nob > 0); + LASSERT(ticks > 0); for (;;) { struct kvec iov = { @@ -337,7 +331,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) .iov_len = nob }; struct msghdr msg = { - .msg_flags = 0 + .msg_flags = 0 }; /* Set receive timeout to remaining time */ @@ -346,7 +340,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) .tv_usec = ((ticks % HZ) * 1000000) / HZ }; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, - (char *)&tv, sizeof(tv)); + (char *)&tv, sizeof(tv)); if (rc != 0) { CERROR("Can't set socket recv timeout %ld.%06d: %d\n", (long)tv.tv_sec, (int)tv.tv_usec, rc); @@ -373,31 +367,30 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) return -ETIMEDOUT; } } - EXPORT_SYMBOL(lnet_sock_read); static int -lnet_sock_create (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port) +lnet_sock_create(struct socket **sockp, int *fatal, __u32 local_ip, + int local_port) { - struct sockaddr_in locaddr; - struct socket *sock; - int rc; - int option; + struct sockaddr_in locaddr; + struct socket *sock; + int rc; + int option; /* All errors are fatal except bind failure if the port is in use */ *fatal = 1; - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock); *sockp = sock; if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); + CERROR("Can't create socket: %d\n", rc); return rc; } option = 1; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); goto failed; @@ -423,27 +416,26 @@ lnet_sock_create (struct socket **sockp, int *fatal, goto failed; } } - return 0; - failed: +failed: sock_release(sock); return rc; } int -lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +lnet_sock_setbuf(struct socket *sock, int txbufsize, int rxbufsize) { - int option; - int rc; + int option; + int rc; if (txbufsize != 0) { option = txbufsize; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set send buffer %d: %d\n", - option, rc); + CERROR("Can't set send buffer %d: %d\n", + option, rc); return rc; } } @@ -451,70 +443,63 @@ lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) if (rxbufsize != 0) { option = rxbufsize; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set receive buffer %d: %d\n", - option, rc); + CERROR("Can't set receive buffer %d: %d\n", + option, rc); return rc; } } - return 0; } - EXPORT_SYMBOL(lnet_sock_setbuf); int -lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) +lnet_sock_getaddr(struct socket *sock, bool remote, __u32 *ip, int *port) { struct sockaddr_in sin; - int len = sizeof (sin); - int rc; + int len = sizeof(sin); + int rc; if (remote) rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len); else rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len); if (rc != 0) { - CERROR ("Error %d getting sock %s IP/port\n", - rc, remote ? "peer" : "local"); + CERROR("Error %d getting sock %s IP/port\n", + rc, remote ? "peer" : "local"); return rc; } if (ip != NULL) - *ip = ntohl (sin.sin_addr.s_addr); + *ip = ntohl(sin.sin_addr.s_addr); if (port != NULL) - *port = ntohs (sin.sin_port); + *port = ntohs(sin.sin_port); return 0; } - EXPORT_SYMBOL(lnet_sock_getaddr); int -lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +lnet_sock_getbuf(struct socket *sock, int *txbufsize, int *rxbufsize) { - - if (txbufsize != NULL) { + if (txbufsize != NULL) *txbufsize = sock->sk->sk_sndbuf; - } - if (rxbufsize != NULL) { + if (rxbufsize != NULL) *rxbufsize = sock->sk->sk_rcvbuf; - } return 0; } - EXPORT_SYMBOL(lnet_sock_getbuf); int -lnet_sock_listen (struct socket **sockp, - __u32 local_ip, int local_port, int backlog) +lnet_sock_listen(struct socket **sockp, __u32 local_ip, int local_port, + int backlog) { - int fatal; - int rc; + int fatal; + int rc; rc = lnet_sock_create(sockp, &fatal, local_ip, local_port); if (rc != 0) { @@ -532,15 +517,14 @@ lnet_sock_listen (struct socket **sockp, sock_release(*sockp); return rc; } - EXPORT_SYMBOL(lnet_sock_listen); int -lnet_sock_accept (struct socket **newsockp, struct socket *sock) +lnet_sock_accept(struct socket **newsockp, struct socket *sock) { - wait_queue_t wait; + wait_queue_t wait; struct socket *newsock; - int rc; + int rc; init_waitqueue_entry(&wait, current); @@ -571,26 +555,24 @@ lnet_sock_accept (struct socket **newsockp, struct socket *sock) *newsockp = newsock; return 0; - failed: +failed: sock_release(newsock); return rc; } - EXPORT_SYMBOL(lnet_sock_accept); int -lnet_sock_connect (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port) +lnet_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, + int local_port, __u32 peer_ip, int peer_port) { - struct sockaddr_in srvaddr; - int rc; + struct sockaddr_in srvaddr; + int rc; rc = lnet_sock_create(sockp, fatal, local_ip, local_port); if (rc != 0) return rc; - memset (&srvaddr, 0, sizeof (srvaddr)); + memset(&srvaddr, 0, sizeof(srvaddr)); srvaddr.sin_family = AF_INET; srvaddr.sin_port = htons(peer_port); srvaddr.sin_addr.s_addr = htonl(peer_ip); @@ -607,11 +589,10 @@ lnet_sock_connect (struct socket **sockp, int *fatal, *fatal = !(rc == -EADDRNOTAVAIL); CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET, - "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, - &local_ip, local_port, &peer_ip, peer_port); + "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, + &local_ip, local_port, &peer_ip, peer_port); sock_release(*sockp); return rc; } - EXPORT_SYMBOL(lnet_sock_connect); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 19:57:13 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:13 -0400 Subject: [lustre-devel] [PATCH v4 7/7] staging:lustre: Update license and copyright for lib-socket.c In-Reply-To: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433361433-24976-8-git-send-email-jsimmons@infradead.org> Point to the right place for GNU license. Update Intel copyright. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index f0b187d..2f8443c 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,11 +23,11 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. */ #define DEBUG_SUBSYSTEM S_LNET -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 19:57:08 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:08 -0400 Subject: [lustre-devel] [PATCH v4 2/7] staging:lustre: remove useless libcfs_sock_release In-Reply-To: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433361433-24976-3-git-send-email-jsimmons@infradead.org> There is no reason to have a one line exported function libcfs_sock_release. Instead we can call sock_release directly. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 8 ++++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index a789559..f469333 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -80,7 +80,6 @@ int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port); int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout); int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout); -void libcfs_sock_release(struct socket *sock); /* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512 diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 7b5d407..38e831f 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1386,7 +1386,7 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, LIBCFS_FREE(conn, sizeof(*conn)); failed_0: - libcfs_sock_release(sock); + sock_release(sock); return rc; } diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index c34378c..06531c1 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -519,7 +519,7 @@ ksocknal_connsock_decref(ksock_conn_t *conn) LASSERT(atomic_read(&conn->ksnc_sock_refcount) > 0); if (atomic_dec_and_test(&conn->ksnc_sock_refcount)) { LASSERT(conn->ksnc_closing); - libcfs_sock_release(conn->ksnc_sock); + sock_release(conn->ksnc_sock); conn->ksnc_sock = NULL; ksocknal_finalize_zcreq(conn); } diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 69d4b19..bc212f5 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -197,7 +197,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, goto failed; failed_sock: - libcfs_sock_release(sock); + sock_release(sock); failed: lnet_connect_console_error(rc, peer_nid, peer_ip, peer_port); return rc; @@ -379,7 +379,7 @@ lnet_acceptor(void *arg) /* maybe we're waken up with libcfs_sock_abort_accept() */ if (lnet_acceptor_state.pta_shutdown) { - libcfs_sock_release(newsock); + sock_release(newsock); break; } @@ -410,10 +410,10 @@ lnet_acceptor(void *arg) continue; failed: - libcfs_sock_release(newsock); + sock_release(newsock); } - libcfs_sock_release(lnet_acceptor_state.pta_sock); + sock_release(lnet_acceptor_state.pta_sock); lnet_acceptor_state.pta_sock = NULL; CDEBUG(D_NET, "Acceptor stopping\n"); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 7f80612..259db61 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -614,11 +614,3 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, } EXPORT_SYMBOL(libcfs_sock_connect); - -void -libcfs_sock_release (struct socket *sock) -{ - sock_release(sock); -} - -EXPORT_SYMBOL(libcfs_sock_release); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 19:57:11 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 15:57:11 -0400 Subject: [lustre-devel] [PATCH v4 5/7] staging:lustre: use available kernel wrappers in lib-socket.c In-Reply-To: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433361433-24976-6-git-send-email-jsimmons@infradead.org> Instead of handling calls to struct proto ourselves we can use equivalent kernel wrappers. No wrapper exist for unlocked ioctl handling so we create one here for our use. I expect some day that function will be integrated into sock.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 47 ++++++++++++++++--------- 1 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 2e87168..2d46a69 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -35,22 +35,37 @@ */ #define DEBUG_SUBSYSTEM S_LNET -#include "../../include/linux/libcfs/libcfs.h" -#include "../../include/linux/lnet/lib-lnet.h" - #include #include +#include #include +#include /* For sys_open & sys_close */ #include +#include + +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" + +static int +kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg) +{ + mm_segment_t oldfs = get_fs(); + int err; + + set_fs(KERNEL_DS); + err = filp->f_op->unlocked_ioctl(filp, cmd, arg); + set_fs(oldfs); + + return err; +} static int lnet_sock_ioctl(int cmd, unsigned long arg) { - mm_segment_t oldmm = get_fs(); + struct file *sock_filp; struct socket *sock; int rc; - struct file *sock_filp; rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); if (rc != 0) { @@ -65,10 +80,7 @@ lnet_sock_ioctl(int cmd, unsigned long arg) goto out; } - set_fs(KERNEL_DS); - if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); - set_fs(oldmm); + rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg); fput(sock_filp); out: @@ -398,8 +410,8 @@ lnet_sock_create (struct socket **sockp, int *fatal, locaddr.sin_addr.s_addr = (local_ip == 0) ? INADDR_ANY : htonl(local_ip); - rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr, - sizeof(locaddr)); + rc = kernel_bind(sock, (struct sockaddr *)&locaddr, + sizeof(locaddr)); if (rc == -EADDRINUSE) { CDEBUG(D_NET, "Port %d already in use\n", local_port); *fatal = 0; @@ -459,8 +471,10 @@ lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) int len = sizeof (sin); int rc; - rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, - remote ? 2 : 0); + if (remote) + rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len); + else + rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len); if (rc != 0) { CERROR ("Error %d getting sock %s IP/port\n", rc, remote ? "peer" : "local"); @@ -510,7 +524,7 @@ lnet_sock_listen (struct socket **sockp, return rc; } - rc = (*sockp)->ops->listen(*sockp, backlog); + rc = kernel_listen(*sockp, backlog); if (rc == 0) return 0; @@ -581,9 +595,8 @@ lnet_sock_connect (struct socket **sockp, int *fatal, srvaddr.sin_port = htons(peer_port); srvaddr.sin_addr.s_addr = htonl(peer_ip); - rc = (*sockp)->ops->connect(*sockp, - (struct sockaddr *)&srvaddr, sizeof(srvaddr), - 0); + rc = kernel_connect(*sockp, (struct sockaddr *)&srvaddr, + sizeof(srvaddr), 0); if (rc == 0) return 0; -- 1.7.1 From colin.faber at seagate.com Wed Jun 3 20:03:10 2015 From: colin.faber at seagate.com (Colin Faber) Date: Wed, 3 Jun 2015 14:03:10 -0600 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: <556F5BA7.1020301@llnl.gov> References: <556F5BA7.1020301@llnl.gov> Message-ID: Hi Chris, >From what I can tell, the OAuth2 and OpenID 2.0 combo does work for google account authentication against gerrit: http://gerrit.cloudlinux.com:8080/login/%23%2Fq%2Fstatus%3Aopen -cf On Wed, Jun 3, 2015 at 1:55 PM, Christopher J. Morrone wrote: > I think you might have that backwards. Google has _stopped_ supporting > OpenID 2.0. To the best of my knowledge no version of gerrit yet supports > Google's new OpenID Connect system. > > Chris > > > On 06/03/2015 12:52 PM, Colin Faber wrote: > >> Hi, >> >> This is probably more a question for the folks at Intel.. Is there an >> ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such >> changes would allow for google logins to function correctly. >> >> -cf >> >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> >> > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.read at intel.com Wed Jun 3 20:14:24 2015 From: robert.read at intel.com (Read, Robert) Date: Wed, 3 Jun 2015 20:14:24 +0000 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: References: <556F5BA7.1020301@llnl.gov> Message-ID: <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> Right, we need OAuth2, which is what Google calls Google OpenID Connect. It looks this has been addressed as of Gerrit 2.10.2. https://code.google.com/p/gerrit/issues/detail?id=2677 robert On Jun 3, 2015, at 13:03 , Colin Faber > wrote: Hi Chris, >From what I can tell, the OAuth2 and OpenID 2.0 combo does work for google account authentication against gerrit: http://gerrit.cloudlinux.com:8080/login/%23%2Fq%2Fstatus%3Aopen -cf On Wed, Jun 3, 2015 at 1:55 PM, Christopher J. Morrone > wrote: I think you might have that backwards. Google has _stopped_ supporting OpenID 2.0. To the best of my knowledge no version of gerrit yet supports Google's new OpenID Connect system. Chris On 06/03/2015 12:52 PM, Colin Faber wrote: Hi, This is probably more a question for the folks at Intel.. Is there an ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such changes would allow for google logins to function correctly. -cf _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From paf at cray.com Wed Jun 3 20:27:45 2015 From: paf at cray.com (Patrick Farrell) Date: Wed, 3 Jun 2015 15:27:45 -0500 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <20150603185716.GA10033@llnl.gov> References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> Message-ID: <556F6341.3070507@cray.com> You say you just install the library and not the utils, but do you specifically build without the utils? Is there some existing config option for that? (Hoping to save myself some grepping...) Otherwise, I'll have to add in that option. It also seems that readline-devel isn't available for the Intel Xeon Phi chips (or at least Cray doesn't have it in our build setup). - Patrick On 06/03/2015 01:57 PM, Ned Bass wrote: > Hi Patrick, > > LLNL builds a stand-alone liblustreapi library for our BG/Q compute > nodes, and readline isn't available there. Now, since we just install > the library and not the utils we don't actually need readline. Perhaps > rather than making the readline configurue check stricly mandatory, we > could add a --disable-utils option which, if specified, would make > readline optional. > > Thanks, > Ned > > On Wed, Jun 03, 2015 at 01:32:05PM -0500, Patrick Farrell wrote: >> Good afternoon, >> >> Cray has recently discovered that 'lfs getstripe' crashes with a >> null pointer if it is not built with libreadline (Found in >> 'readline-devel'). >> >> When built without libreadline, Lustre uses its own implementation >> of the readline components it needs. (Look for "HAVE_LIBREADLINE" >> in libcfs/libcfs/util/parser.c) This is the source of the null >> pointer. >> >> I think libreadline should be available on every platform we wish to >> build Lustre on, so I'd rather not fix the broken internal version >> of it. Given that, is there any objection to adding an explicit >> BuildRequires to the spec, making it mandatory in the config >> process, and removing all traces of Lustre's internal readline >> implementation? If not, I'll open a Jira ticket to do this. >> >> - Patrick >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From colin.faber at seagate.com Wed Jun 3 20:32:53 2015 From: colin.faber at seagate.com (Colin Faber) Date: Wed, 3 Jun 2015 14:32:53 -0600 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> References: <556F5BA7.1020301@llnl.gov> <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> Message-ID: So I guess coming back around to the original question, any ETA or idea when / if this will be available? =) -cf On Wed, Jun 3, 2015 at 2:14 PM, Read, Robert wrote: > Right, we need OAuth2, which is what Google calls Google OpenID Connect. > It looks this has been addressed as of Gerrit 2.10.2. > > https://code.google.com/p/gerrit/issues/detail?id=2677 > > > robert > > > On Jun 3, 2015, at 13:03 , Colin Faber colin.faber at seagate.com>> wrote: > > Hi Chris, > > From what I can tell, the OAuth2 and OpenID 2.0 combo does work for google > account authentication against gerrit: > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__gerrit.cloudlinux.com-3A8080_login_-2523-252Fq-252Fstatus-253Aopen&d=AwIFAg&c=IGDlg0lD0b-nebmJJ0Kp8A&r=x9pM59OqndbWw-lPPdr8w1Vud29EZigcxcNkz0uw5oQ&m=2TZ9J8tYpzP7LWdaW6rjmipw1eWHcfszrDgaL-Ok6dc&s=uIy4ooW8SY3s2WtLNxy4Av8Yu3YE6wUY9sCn7DDnEws&e= > > > -cf > > > > On Wed, Jun 3, 2015 at 1:55 PM, Christopher J. Morrone > wrote: > I think you might have that backwards. Google has _stopped_ supporting > OpenID 2.0. To the best of my knowledge no version of gerrit yet supports > Google's new OpenID Connect system. > > Chris > > > On 06/03/2015 12:52 PM, Colin Faber wrote: > Hi, > > This is probably more a question for the folks at Intel.. Is there an > ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such > changes would allow for google logins to function correctly. > > -cf > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.lustre.org_listinfo.cgi_lustre-2Ddevel-2Dlustre.org&d=AwIFAg&c=IGDlg0lD0b-nebmJJ0Kp8A&r=x9pM59OqndbWw-lPPdr8w1Vud29EZigcxcNkz0uw5oQ&m=2TZ9J8tYpzP7LWdaW6rjmipw1eWHcfszrDgaL-Ok6dc&s=7ye70YNBCUYjesG3rFEiQo5M7y5yr4F6s_KuY1Ngaco&e= > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.lustre.org_listinfo.cgi_lustre-2Ddevel-2Dlustre.org&d=AwIFAg&c=IGDlg0lD0b-nebmJJ0Kp8A&r=x9pM59OqndbWw-lPPdr8w1Vud29EZigcxcNkz0uw5oQ&m=2TZ9J8tYpzP7LWdaW6rjmipw1eWHcfszrDgaL-Ok6dc&s=7ye70YNBCUYjesG3rFEiQo5M7y5yr4F6s_KuY1Ngaco&e= > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.lustre.org_listinfo.cgi_lustre-2Ddevel-2Dlustre.org&d=AwIFAg&c=IGDlg0lD0b-nebmJJ0Kp8A&r=x9pM59OqndbWw-lPPdr8w1Vud29EZigcxcNkz0uw5oQ&m=2TZ9J8tYpzP7LWdaW6rjmipw1eWHcfszrDgaL-Ok6dc&s=7ye70YNBCUYjesG3rFEiQo5M7y5yr4F6s_KuY1Ngaco&e= > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsimmons at infradead.org Wed Jun 3 20:43:19 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:19 -0400 Subject: [lustre-devel] [PATCH v3 0/8] staging:lustre: remove kernel defines in userland headers Message-ID: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Currently the lnet headers used for user land applications contain various kernel definations. This is due to the fact libcfs contains kernel wrappers for user land which will be going away. This patch sorted the header data so all kernel containing structures are moved out of headers that user land will use. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/13792 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger James Simmons (7): staging:lustre: fixup LNet resource container api staging:lustre: delete no longer used LNet headers staging:lustre: move LNet NID macros to LNet layer staging:lustre: separate kernel and user land defines in the LNet headers staging:lustre: fix camel case for LNetInit and LNetFini staging:lustre: style cleanups for LNet headers staging:lustre: Update license and copyright for the LNET headers John L. Hammond (1): staging:lustre: assume a kernel build .../lustre/include/linux/libcfs/libcfs_private.h | 55 -- .../lustre/include/linux/lnet/api-support.h | 44 -- drivers/staging/lustre/include/linux/lnet/api.h | 48 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 266 ++--------- .../staging/lustre/include/linux/lnet/lib-types.h | 523 +++++++------------- .../lustre/include/linux/lnet/linux/api-support.h | 42 -- .../lustre/include/linux/lnet/linux/lib-lnet.h | 71 --- .../lustre/include/linux/lnet/linux/lib-types.h | 45 -- .../staging/lustre/include/linux/lnet/linux/lnet.h | 56 --- .../lustre/include/linux/lnet/lnet-sysctl.h | 49 -- drivers/staging/lustre/include/linux/lnet/lnet.h | 17 +- .../staging/lustre/include/linux/lnet/lnetctl.h | 7 +- drivers/staging/lustre/include/linux/lnet/lnetst.h | 490 ++++++++++--------- drivers/staging/lustre/include/linux/lnet/nidstr.h | 77 +++ drivers/staging/lustre/include/linux/lnet/ptllnd.h | 93 ---- .../lustre/include/linux/lnet/ptllnd_wire.h | 119 ----- .../staging/lustre/include/linux/lnet/socklnd.h | 68 ++-- drivers/staging/lustre/include/linux/lnet/types.h | 288 +++++++++--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 1 - .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 1 - .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 4 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 - drivers/staging/lustre/lnet/lnet/api-ni.c | 97 +--- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 6 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 6 +- drivers/staging/lustre/lnet/lnet/lib-msg.c | 2 +- drivers/staging/lustre/lnet/lnet/module.c | 6 +- drivers/staging/lustre/lnet/lnet/router.c | 145 ------ .../lustre/lustre/include/lustre/lustre_idl.h | 1 + drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- 32 files changed, 876 insertions(+), 1761 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/lnet/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-types.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h create mode 100644 drivers/staging/lustre/include/linux/lnet/nidstr.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h From jsimmons at infradead.org Wed Jun 3 20:43:25 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:25 -0400 Subject: [lustre-devel] [PATCH v3 6/8] staging:lustre: fix camel case for LNetInit and LNetFini In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-7-git-send-email-jsimmons@infradead.org> For the functions LNetInit and LNetFini move away from camel case to lnet_init and lnet_fini. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/api.h | 3 --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 3 +++ .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 16 ++++++++-------- drivers/staging/lustre/lnet/lnet/module.c | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index c4dc1b2..dee7f27 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -52,9 +52,6 @@ /** \defgroup lnet_init_fini Initialization and cleanup * The LNet must be properly initialized before any LNet calls can be made. * @{ */ -int LNetInit(void); -void LNetFini(void); - int LNetNIInit(lnet_pid_t requested_pid); int LNetNIFini(void); /** @} lnet_init_fini */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 2750570..15e6a2e 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -434,6 +434,9 @@ lnet_ni_t *lnet_nid2ni_locked(lnet_nid_t nid, int cpt); lnet_ni_t *lnet_net2ni_locked(__u32 net, int cpt); lnet_ni_t *lnet_net2ni(__u32 net); +int lnet_init(void); +void lnet_fini(void); + int lnet_notify(lnet_ni_t *ni, lnet_nid_t peer, int alive, unsigned long when); void lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index fdf94dd..8e8e725 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -575,7 +575,7 @@ typedef struct { struct mutex ln_api_mutex; struct mutex ln_lnd_mutex; - int ln_init; /* LNetInit() called? */ + int ln_init; /* lnet_init() called? */ /* Have I called LNetNIInit myself? */ int ln_niinit_self; /* LNetNIInit/LNetNIFini counter */ diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 57e9752..d14fe70 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1101,14 +1101,14 @@ lnet_startup_lndnis(void) * Initialize LNet library. * * Only userspace program needs to call this function - it's automatically - * called in the kernel at module loading time. Caller has to call LNetFini() - * after a call to LNetInit(), if and only if the latter returned 0. It must + * called in the kernel at module loading time. Caller has to call lnet_fini() + * after a call to lnet_init(), if and only if the latter returned 0. It must * be called exactly once. * * \return 0 on success, and -ve on failures. */ int -LNetInit(void) +lnet_init(void) { int rc; @@ -1161,7 +1161,7 @@ LNetInit(void) lnet_register_lnd(&the_lolnd); return 0; } -EXPORT_SYMBOL(LNetInit); +EXPORT_SYMBOL(lnet_init); /** * Finalize LNet library. @@ -1169,11 +1169,11 @@ EXPORT_SYMBOL(LNetInit); * Only userspace program needs to call this function. It can be called * at most once. * - * \pre LNetInit() called with success. + * \pre lnet_init() called with success. * \pre All LNet users called LNetNIFini() for matching LNetNIInit() calls. */ void -LNetFini(void) +lnet_fini(void) { LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_refcount == 0); @@ -1185,12 +1185,12 @@ LNetFini(void) the_lnet.ln_init = 0; } -EXPORT_SYMBOL(LNetFini); +EXPORT_SYMBOL(lnet_fini); /** * Set LNet PID and start LNet interfaces, routing, and forwarding. * - * Userspace program should call this after a successful call to LNetInit(). + * Userspace program should call this after a successful call to lnet_init(). * Users must call this function at least once before any other functions. * For each successful call there must be a corresponding call to * LNetNIFini(). For subsequent calls to LNetNIInit(), \a requested_pid is diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index 6881b9c..576201a 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -117,9 +117,9 @@ init_lnet(void) mutex_init(&lnet_config_mutex); - rc = LNetInit(); + rc = lnet_init(); if (rc != 0) { - CERROR("LNetInit: error %d\n", rc); + CERROR("lnet_init: error %d\n", rc); return rc; } @@ -143,7 +143,7 @@ fini_lnet(void) rc = libcfs_deregister_ioctl(&lnet_ioctl_handler); LASSERT(rc == 0); - LNetFini(); + lnet_fini(); } MODULE_AUTHOR("Peter J. Braam "); -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 20:43:24 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:24 -0400 Subject: [lustre-devel] [PATCH v3 5/8] staging:lustre: separate kernel and user land defines in the LNet headers In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-6-git-send-email-jsimmons@infradead.org> Currently the lnet headers used by user land contain various internal LNet structures that are only used by kernel space. Move the user land structures to headers used by user land. The kernel structures are relocated to headers that are never exposed to user land. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 3 - .../staging/lustre/include/linux/lnet/lib-types.h | 175 ++----------------- .../staging/lustre/include/linux/lnet/lnetctl.h | 7 +- drivers/staging/lustre/include/linux/lnet/lnetst.h | 5 +- .../staging/lustre/include/linux/lnet/socklnd.h | 1 - drivers/staging/lustre/include/linux/lnet/types.h | 169 +++++++++++++++++-- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 - drivers/staging/lustre/lnet/lnet/api-ni.c | 3 +- 8 files changed, 180 insertions(+), 185 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index c224062..2750570 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -34,8 +34,6 @@ * Lustre is a trademark of Sun Microsystems, Inc. * * lnet/include/lnet/lib-lnet.h - * - * Top level include for library side routines */ #ifndef __LNET_LIB_LNET_H__ @@ -43,7 +41,6 @@ #include "../libcfs/libcfs.h" #include "api.h" -#include "types.h" #include "lnet.h" #include "lib-types.h" diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 4177da2..fdf94dd 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -42,129 +42,20 @@ #ifndef __LNET_LIB_TYPES_H__ #define __LNET_LIB_TYPES_H__ -#include "../libcfs/libcfs.h" -#include -#include "types.h" - -#define WIRE_ATTR __attribute__((packed)) - -/* Packed version of lnet_process_id_t to transfer via network */ -typedef struct { - lnet_nid_t nid; - lnet_pid_t pid; /* node id / process id */ -} WIRE_ATTR lnet_process_id_packed_t; - -/* The wire handle's interface cookie only matches one network interface in - * one epoch (i.e. new cookie when the interface restarts or the node - * reboots). The object cookie only matches one object on that interface - * during that object's lifetime (i.e. no cookie re-use). */ -typedef struct { - __u64 wh_interface_cookie; - __u64 wh_object_cookie; -} WIRE_ATTR lnet_handle_wire_t; - -typedef enum { - LNET_MSG_ACK = 0, - LNET_MSG_PUT, - LNET_MSG_GET, - LNET_MSG_REPLY, - LNET_MSG_HELLO, -} lnet_msg_type_t; - -/* The variant fields of the portals message header are aligned on an 8 - * byte boundary in the message header. Note that all types used in these - * wire structs MUST be fixed size and the smaller types are placed at the - * end. */ -typedef struct lnet_ack { - lnet_handle_wire_t dst_wmd; - __u64 match_bits; - __u32 mlength; -} WIRE_ATTR lnet_ack_t; - -typedef struct lnet_put { - lnet_handle_wire_t ack_wmd; - __u64 match_bits; - __u64 hdr_data; - __u32 ptl_index; - __u32 offset; -} WIRE_ATTR lnet_put_t; - -typedef struct lnet_get { - lnet_handle_wire_t return_wmd; - __u64 match_bits; - __u32 ptl_index; - __u32 src_offset; - __u32 sink_length; -} WIRE_ATTR lnet_get_t; - -typedef struct lnet_reply { - lnet_handle_wire_t dst_wmd; -} WIRE_ATTR lnet_reply_t; - -typedef struct lnet_hello { - __u64 incarnation; - __u32 type; -} WIRE_ATTR lnet_hello_t; +#include +#include +#include +#include -typedef struct { - lnet_nid_t dest_nid; - lnet_nid_t src_nid; - lnet_pid_t dest_pid; - lnet_pid_t src_pid; - __u32 type; /* lnet_msg_type_t */ - __u32 payload_length; /* payload data to follow */ - /*<------__u64 aligned------->*/ - union { - lnet_ack_t ack; - lnet_put_t put; - lnet_get_t get; - lnet_reply_t reply; - lnet_hello_t hello; - } msg; -} WIRE_ATTR lnet_hdr_t; - -/* A HELLO message contains a magic number and protocol version - * code in the header's dest_nid, the peer's NID in the src_nid, and - * LNET_MSG_HELLO in the type field. All other common fields are zero - * (including payload_size; i.e. no payload). - * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is - * running the same protocol and to find out its NID. These LNDs should - * exchange HELLO messages when a connection is first established. Individual - * LNDs can put whatever else they fancy in lnet_hdr_t::msg. - */ -typedef struct { - __u32 magic; /* LNET_PROTO_TCP_MAGIC */ - __u16 version_major; /* increment on incompatible change */ - __u16 version_minor; /* increment on compatible change */ -} WIRE_ATTR lnet_magicversion_t; - -/* PROTO MAGIC for LNDs */ -#define LNET_PROTO_IB_MAGIC 0x0be91b91 -#define LNET_PROTO_RA_MAGIC 0x0be91b92 -#define LNET_PROTO_QSW_MAGIC 0x0be91b93 -#define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */ -#define LNET_PROTO_TCP_MAGIC 0xeebc0ded -#define LNET_PROTO_PTL_MAGIC 0x50746C4E /* 'PtlN' unique magic */ -#define LNET_PROTO_MX_MAGIC 0x4d583130 /* 'MX10'! */ -#define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100 -#define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */ - -/* Placeholder for a future "unified" protocol across all LNDs */ -/* Current LNDs that receive a request with this magic will respond with a - * "stub" reply using their current protocol */ -#define LNET_PROTO_MAGIC 0x45726963 /* ! */ - -#define LNET_PROTO_TCP_VERSION_MAJOR 1 -#define LNET_PROTO_TCP_VERSION_MINOR 0 - -/* Acceptor connection request */ -typedef struct { - __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */ - __u32 acr_version; /* protocol version */ - __u64 acr_nid; /* target NID */ -} WIRE_ATTR lnet_acceptor_connreq_t; +#include "types.h" -#define LNET_PROTO_ACCEPTOR_VERSION 1 +/* Max payload size */ +#define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD +#if (LNET_MAX_PAYLOAD < LNET_MTU) +# error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb" +#elif (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV)) +# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" +#endif /* forward refs */ struct lnet_libmd; @@ -299,7 +190,7 @@ typedef struct lnet_lnd { int lnd_refcount; /* # active instances */ /* fields initialised by the LND */ - unsigned int lnd_type; + __u32 lnd_type; int (*lnd_startup)(struct lnet_ni *ni); void (*lnd_shutdown)(struct lnet_ni *ni); @@ -353,15 +244,6 @@ typedef struct lnet_lnd { } lnd_t; -#define LNET_NI_STATUS_UP 0x15aac0de -#define LNET_NI_STATUS_DOWN 0xdeadface -#define LNET_NI_STATUS_INVALID 0x00000000 -typedef struct { - lnet_nid_t ns_nid; - __u32 ns_status; - __u32 ns_unused; -} WIRE_ATTR lnet_ni_status_t; - struct lnet_tx_queue { int tq_credits; /* # tx credits free */ int tq_credits_min; /* lowest it's been */ @@ -369,8 +251,6 @@ struct lnet_tx_queue { struct list_head tq_delayed; /* delayed TXs */ }; -#define LNET_MAX_INTERFACES 16 - typedef struct lnet_ni { spinlock_t ni_lock; struct list_head ni_list; /* chain on ln_nis */ @@ -406,14 +286,6 @@ typedef struct lnet_ni { #define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \ LNET_PING_FEAT_NI_STATUS) -typedef struct { - __u32 pi_magic; - __u32 pi_features; - lnet_pid_t pi_pid; - __u32 pi_nnis; - lnet_ni_status_t pi_ni[0]; -} WIRE_ATTR lnet_ping_info_t; - /* router checker data, per router */ #define LNET_MAX_RTR_NIS 16 #define LNET_PINGINFO_SIZE offsetof(lnet_ping_info_t, pi_ni[LNET_MAX_RTR_NIS]) @@ -496,6 +368,11 @@ typedef struct { __u32 lrn_net; /* my net number */ } lnet_remotenet_t; +/** lnet message has credit and can be submitted to lnd for send/receive */ +#define LNET_CREDIT_OK 0 +/** lnet message is waiting for credit */ +#define LNET_CREDIT_WAIT 1 + typedef struct { struct list_head rbp_bufs; /* my free buffer pool */ struct list_head rbp_msgs; /* messages blocking for a buffer */ @@ -511,23 +388,9 @@ typedef struct { lnet_kiov_t rb_kiov[0]; /* the buffer space */ } lnet_rtrbuf_t; -typedef struct { - __u32 msgs_alloc; - __u32 msgs_max; - __u32 errors; - __u32 send_count; - __u32 recv_count; - __u32 route_count; - __u32 drop_count; - __u64 send_length; - __u64 recv_length; - __u64 route_length; - __u64 drop_length; -} WIRE_ATTR lnet_counters_t; - #define LNET_PEER_HASHSIZE 503 /* prime! */ -#define LNET_NRBPOOLS 3 /* # different router buffer pools */ +#define LNET_NRBPOOLS 3 /* # different router buffer pools */ enum { /* Didn't match anything */ diff --git a/drivers/staging/lustre/include/linux/lnet/lnetctl.h b/drivers/staging/lustre/include/linux/lnet/lnetctl.h index 98181d3..bdd69b2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetctl.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetctl.h @@ -14,12 +14,11 @@ * along with Portals; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * header for libptlctl.a + * header for lnet ioctl */ -#ifndef _PTLCTL_H_ -#define _PTLCTL_H_ +#ifndef _LNETCTL_H_ +#define _LNETCTL_H_ -#include "../libcfs/libcfs.h" #include "types.h" #define LNET_DEV_ID 0 diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 885f708..57432fd 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -41,9 +41,7 @@ #ifndef __LNET_ST_H__ #define __LNET_ST_H__ -#include "../libcfs/libcfs.h" -#include "lnet.h" -#include "lib-types.h" +#include #define LST_FEAT_NONE (0) #define LST_FEAT_BULK_LEN (1 << 0) /* enable variable page size */ @@ -468,7 +466,6 @@ typedef struct { int png_flags; /* reserved flags */ } lst_test_ping_param_t; -/* more tests */ typedef struct { __u32 errors; __u32 rpcs_sent; diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 389038b..f7c7b08 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -39,7 +39,6 @@ #define __LNET_LNET_SOCKLND_H__ #include "types.h" -#include "lib-types.h" #define SOCKLND_CONN_NONE (-1) #define SOCKLND_CONN_ANY 0 diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 15528a1..32b9431 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -37,11 +37,11 @@ #ifndef __LNET_TYPES_H__ #define __LNET_TYPES_H__ +#include + /** \addtogroup lnet * @{ */ -#include "../libcfs/libcfs.h" - /** \addtogroup lnet_addr * @{ */ @@ -74,6 +74,7 @@ typedef __u32 lnet_pid_t; #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */ #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */ +#define LNET_PID_LUSTRE 12345 #define LNET_TIME_FOREVER (-1) @@ -110,7 +111,158 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) return (type << 16) | num; } -/** +#define WIRE_ATTR __packed + +/* Packed version of lnet_process_id_t to transfer via network */ +typedef struct { + /* node id / process id */ + lnet_nid_t nid; + lnet_pid_t pid; +} WIRE_ATTR lnet_process_id_packed_t; + +/* The wire handle's interface cookie only matches one network interface in + * one epoch (i.e. new cookie when the interface restarts or the node + * reboots). The object cookie only matches one object on that interface + * during that object's lifetime (i.e. no cookie re-use). */ +typedef struct { + __u64 wh_interface_cookie; + __u64 wh_object_cookie; +} WIRE_ATTR lnet_handle_wire_t; + +typedef enum { + LNET_MSG_ACK = 0, + LNET_MSG_PUT, + LNET_MSG_GET, + LNET_MSG_REPLY, + LNET_MSG_HELLO, +} lnet_msg_type_t; + +/* The variant fields of the portals message header are aligned on an 8 + * byte boundary in the message header. Note that all types used in these + * wire structs MUST be fixed size and the smaller types are placed at the + * end. */ +typedef struct lnet_ack { + lnet_handle_wire_t dst_wmd; + __u64 match_bits; + __u32 mlength; +} WIRE_ATTR lnet_ack_t; + +typedef struct lnet_put { + lnet_handle_wire_t ack_wmd; + __u64 match_bits; + __u64 hdr_data; + __u32 ptl_index; + __u32 offset; +} WIRE_ATTR lnet_put_t; + +typedef struct lnet_get { + lnet_handle_wire_t return_wmd; + __u64 match_bits; + __u32 ptl_index; + __u32 src_offset; + __u32 sink_length; +} WIRE_ATTR lnet_get_t; + +typedef struct lnet_reply { + lnet_handle_wire_t dst_wmd; +} WIRE_ATTR lnet_reply_t; + +typedef struct lnet_hello { + __u64 incarnation; + __u32 type; +} WIRE_ATTR lnet_hello_t; + +typedef struct { + lnet_nid_t dest_nid; + lnet_nid_t src_nid; + lnet_pid_t dest_pid; + lnet_pid_t src_pid; + __u32 type; /* lnet_msg_type_t */ + __u32 payload_length; /* payload data to follow */ + /*<------__u64 aligned------->*/ + union { + lnet_ack_t ack; + lnet_put_t put; + lnet_get_t get; + lnet_reply_t reply; + lnet_hello_t hello; + } msg; +} WIRE_ATTR lnet_hdr_t; + +/* A HELLO message contains a magic number and protocol version + * code in the header's dest_nid, the peer's NID in the src_nid, and + * LNET_MSG_HELLO in the type field. All other common fields are zero + * (including payload_size; i.e. no payload). + * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is + * running the same protocol and to find out its NID. These LNDs should + * exchange HELLO messages when a connection is first established. Individual + * LNDs can put whatever else they fancy in lnet_hdr_t::msg. + */ +typedef struct { + __u32 magic; /* LNET_PROTO_TCP_MAGIC */ + __u16 version_major; /* increment on incompatible change */ + __u16 version_minor; /* increment on compatible change */ +} WIRE_ATTR lnet_magicversion_t; + +/* PROTO MAGIC for LNDs */ +#define LNET_PROTO_IB_MAGIC 0x0be91b91 +#define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */ +#define LNET_PROTO_TCP_MAGIC 0xeebc0ded +#define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100 +#define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */ + +/* Placeholder for a future "unified" protocol across all LNDs */ +/* Current LNDs that receive a request with this magic will respond with a + * "stub" reply using their current protocol */ +#define LNET_PROTO_MAGIC 0x45726963 /* ! */ + +#define LNET_PROTO_TCP_VERSION_MAJOR 1 +#define LNET_PROTO_TCP_VERSION_MINOR 0 + +/* Acceptor connection request */ +typedef struct { + __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */ + __u32 acr_version; /* protocol version */ + __u64 acr_nid; /* target NID */ +} WIRE_ATTR lnet_acceptor_connreq_t; + +#define LNET_PROTO_ACCEPTOR_VERSION 1 + +typedef struct { + lnet_nid_t ns_nid; + __u32 ns_status; + __u32 ns_unused; +} WIRE_ATTR lnet_ni_status_t; + +typedef struct { + __u32 pi_magic; + __u32 pi_features; + lnet_pid_t pi_pid; + __u32 pi_nnis; + lnet_ni_status_t pi_ni[0]; +} WIRE_ATTR lnet_ping_info_t; + +typedef struct lnet_counters { + __u32 msgs_alloc; + __u32 msgs_max; + __u32 errors; + __u32 send_count; + __u32 recv_count; + __u32 route_count; + __u32 drop_count; + __u64 send_length; + __u64 recv_length; + __u64 route_length; + __u64 drop_length; +} WIRE_ATTR lnet_counters_t; + +#define LNET_NI_STATUS_UP 0x15aac0de +#define LNET_NI_STATUS_DOWN 0xdeadface +#define LNET_NI_STATUS_INVALID 0x00000000 + +#define LNET_MAX_INTERFACES 16 + +/* * Objects maintained by the LNet are accessed through handles. Handle types * have names of the form lnet_handle_xx_t, where xx is one of the two letter * object type codes ('eq' for event queue, 'md' for memory descriptor, and @@ -311,17 +463,6 @@ typedef struct { /** limit on the number of fragments in discontiguous MDs */ #define LNET_MAX_IOV 256 -/* Max payload size */ -# define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD -# if (LNET_MAX_PAYLOAD < LNET_MTU) -# error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb" -# else -# if (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV)) -/* PAGE_SIZE is a constant: check with cpp! */ -# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" -# endif -# endif - /** * Options for the MD structure. See lnet_md_t::options. */ diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 1dc7c8a..4928f5c 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -243,8 +243,6 @@ lnet_accept(struct socket *sock, __u32 magic) if (magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC)) str = "'old' socknal/tcpnal"; - else if (lnet_accept_magic(magic, LNET_PROTO_RA_MAGIC)) - str = "'old' ranal"; else str = "unrecognised"; diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index a2d0d10..57e9752 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -35,10 +35,11 @@ */ #define DEBUG_SUBSYSTEM S_LNET -#include "../../include/linux/lnet/lib-lnet.h" #include #include +#include "../../include/linux/lnet/lib-lnet.h" + #define D_LNI D_CONSOLE lnet_t the_lnet; /* THE state of the network */ -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 20:43:20 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:20 -0400 Subject: [lustre-devel] [PATCH v3 1/8] staging:lustre: assume a kernel build In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-2-git-send-email-jsimmons@infradead.org> From: John L. Hammond In lnet/lnet/ and lnet/selftest/ assume a kernel build (assume that __KERNEL__ is defined). Remove some common code only needed for user space LNet. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/13121 Reviewed-by: James Simmons Reviewed-by: Amir Shehata Reviewed-by: Oleg Drokin --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 215 +------------------- .../staging/lustre/include/linux/lnet/lib-types.h | 20 -- drivers/staging/lustre/lnet/lnet/api-ni.c | 69 +------ drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 6 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 6 +- drivers/staging/lustre/lnet/lnet/lib-msg.c | 2 +- 7 files changed, 16 insertions(+), 304 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index ff07703..ac3be94 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -49,24 +49,17 @@ extern lnet_t the_lnet; /* THE network */ -#if defined(LNET_USE_LIB_FREELIST) -/* 1 CPT, simplify implementation... */ -# define LNET_CPT_MAX_BITS 0 - -#else /* KERNEL and no freelist */ - -# if (BITS_PER_LONG == 32) +#if (BITS_PER_LONG == 32) /* 2 CPTs, allowing more CPTs might make us under memory pressure */ -# define LNET_CPT_MAX_BITS 1 +# define LNET_CPT_MAX_BITS 1 -# else /* 64-bit system */ +#else /* 64-bit system */ /* * 256 CPTs for thousands of CPUs, allowing more CPTs might make us * under risk of consuming all lh_cookie. */ -# define LNET_CPT_MAX_BITS 8 -# endif /* BITS_PER_LONG == 32 */ -#endif +# define LNET_CPT_MAX_BITS 8 +#endif /* BITS_PER_LONG == 32 */ /* max allowed CPT number */ #define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS) @@ -175,191 +168,9 @@ lnet_net_lock_current(void) #define MAX_PORTALS 64 -/* these are only used by code with LNET_USE_LIB_FREELIST, but we still - * exported them to !LNET_USE_LIB_FREELIST for easy implementation */ -#define LNET_FL_MAX_MES 2048 -#define LNET_FL_MAX_MDS 2048 -#define LNET_FL_MAX_EQS 512 -#define LNET_FL_MAX_MSGS 2048 /* Outstanding messages */ - -#ifdef LNET_USE_LIB_FREELIST - -int lnet_freelist_init(lnet_freelist_t *fl, int n, int size); -void lnet_freelist_fini(lnet_freelist_t *fl); - -static inline void * -lnet_freelist_alloc(lnet_freelist_t *fl) -{ - /* ALWAYS called with liblock held */ - lnet_freeobj_t *o; - - if (list_empty(&fl->fl_list)) - return NULL; - - o = list_entry(fl->fl_list.next, lnet_freeobj_t, fo_list); - list_del(&o->fo_list); - return (void *)&o->fo_contents; -} - -static inline void -lnet_freelist_free(lnet_freelist_t *fl, void *obj) -{ - /* ALWAYS called with liblock held */ - lnet_freeobj_t *o = list_entry(obj, lnet_freeobj_t, fo_contents); - - list_add(&o->fo_list, &fl->fl_list); -} - -static inline lnet_eq_t * -lnet_eq_alloc(void) -{ - /* NEVER called with resource lock held */ - struct lnet_res_container *rec = &the_lnet.ln_eq_container; - lnet_eq_t *eq; - - LASSERT(LNET_CPT_NUMBER == 1); - - lnet_res_lock(0); - eq = (lnet_eq_t *)lnet_freelist_alloc(&rec->rec_freelist); - lnet_res_unlock(0); - - return eq; -} - -static inline void -lnet_eq_free_locked(lnet_eq_t *eq) -{ - /* ALWAYS called with resource lock held */ - struct lnet_res_container *rec = &the_lnet.ln_eq_container; - - LASSERT(LNET_CPT_NUMBER == 1); - lnet_freelist_free(&rec->rec_freelist, eq); -} - -static inline void -lnet_eq_free(lnet_eq_t *eq) -{ - lnet_res_lock(0); - lnet_eq_free_locked(eq); - lnet_res_unlock(0); -} - -static inline lnet_libmd_t * -lnet_md_alloc(lnet_md_t *umd) -{ - /* NEVER called with resource lock held */ - struct lnet_res_container *rec = the_lnet.ln_md_containers[0]; - lnet_libmd_t *md; - - LASSERT(LNET_CPT_NUMBER == 1); - - lnet_res_lock(0); - md = (lnet_libmd_t *)lnet_freelist_alloc(&rec->rec_freelist); - lnet_res_unlock(0); - - if (md != NULL) - INIT_LIST_HEAD(&md->md_list); - - return md; -} - -static inline void -lnet_md_free_locked(lnet_libmd_t *md) -{ - /* ALWAYS called with resource lock held */ - struct lnet_res_container *rec = the_lnet.ln_md_containers[0]; - - LASSERT(LNET_CPT_NUMBER == 1); - lnet_freelist_free(&rec->rec_freelist, md); -} - -static inline void -lnet_md_free(lnet_libmd_t *md) -{ - lnet_res_lock(0); - lnet_md_free_locked(md); - lnet_res_unlock(0); -} - -static inline lnet_me_t * -lnet_me_alloc(void) -{ - /* NEVER called with resource lock held */ - struct lnet_res_container *rec = the_lnet.ln_me_containers[0]; - lnet_me_t *me; - - LASSERT(LNET_CPT_NUMBER == 1); - - lnet_res_lock(0); - me = (lnet_me_t *)lnet_freelist_alloc(&rec->rec_freelist); - lnet_res_unlock(0); - - return me; -} - -static inline void -lnet_me_free_locked(lnet_me_t *me) -{ - /* ALWAYS called with resource lock held */ - struct lnet_res_container *rec = the_lnet.ln_me_containers[0]; - - LASSERT(LNET_CPT_NUMBER == 1); - lnet_freelist_free(&rec->rec_freelist, me); -} - -static inline void -lnet_me_free(lnet_me_t *me) -{ - lnet_res_lock(0); - lnet_me_free_locked(me); - lnet_res_unlock(0); -} - -static inline lnet_msg_t * -lnet_msg_alloc(void) -{ - /* NEVER called with network lock held */ - struct lnet_msg_container *msc = the_lnet.ln_msg_containers[0]; - lnet_msg_t *msg; - - LASSERT(LNET_CPT_NUMBER == 1); - - lnet_net_lock(0); - msg = (lnet_msg_t *)lnet_freelist_alloc(&msc->msc_freelist); - lnet_net_unlock(0); - - if (msg != NULL) { - /* NULL pointers, clear flags etc */ - memset(msg, 0, sizeof(*msg)); - } - return msg; -} - -static inline void -lnet_msg_free_locked(lnet_msg_t *msg) -{ - /* ALWAYS called with network lock held */ - struct lnet_msg_container *msc = the_lnet.ln_msg_containers[0]; - - LASSERT(LNET_CPT_NUMBER == 1); - LASSERT(!msg->msg_onactivelist); - lnet_freelist_free(&msc->msc_freelist, msg); -} - -static inline void -lnet_msg_free(lnet_msg_t *msg) -{ - lnet_net_lock(0); - lnet_msg_free_locked(msg); - lnet_net_unlock(0); -} - -#else /* !LNET_USE_LIB_FREELIST */ - static inline lnet_eq_t * lnet_eq_alloc(void) { - /* NEVER called with liblock held */ lnet_eq_t *eq; LIBCFS_ALLOC(eq, sizeof(*eq)); @@ -369,14 +180,12 @@ lnet_eq_alloc(void) static inline void lnet_eq_free(lnet_eq_t *eq) { - /* ALWAYS called with resource lock held */ LIBCFS_FREE(eq, sizeof(*eq)); } static inline lnet_libmd_t * lnet_md_alloc(lnet_md_t *umd) { - /* NEVER called with liblock held */ lnet_libmd_t *md; unsigned int size; unsigned int niov; @@ -405,7 +214,6 @@ lnet_md_alloc(lnet_md_t *umd) static inline void lnet_md_free(lnet_libmd_t *md) { - /* ALWAYS called with resource lock held */ unsigned int size; if ((md->md_options & LNET_MD_KIOV) != 0) @@ -419,7 +227,6 @@ lnet_md_free(lnet_libmd_t *md) static inline lnet_me_t * lnet_me_alloc(void) { - /* NEVER called with liblock held */ lnet_me_t *me; LIBCFS_ALLOC(me, sizeof(*me)); @@ -429,14 +236,12 @@ lnet_me_alloc(void) static inline void lnet_me_free(lnet_me_t *me) { - /* ALWAYS called with resource lock held */ LIBCFS_FREE(me, sizeof(*me)); } static inline lnet_msg_t * lnet_msg_alloc(void) { - /* NEVER called with liblock held */ lnet_msg_t *msg; LIBCFS_ALLOC(msg, sizeof(*msg)); @@ -448,18 +253,10 @@ lnet_msg_alloc(void) static inline void lnet_msg_free(lnet_msg_t *msg) { - /* ALWAYS called with network lock held */ LASSERT(!msg->msg_onactivelist); LIBCFS_FREE(msg, sizeof(*msg)); } -#define lnet_eq_free_locked(eq) lnet_eq_free(eq) -#define lnet_md_free_locked(md) lnet_md_free(md) -#define lnet_me_free_locked(me) lnet_me_free(me) -#define lnet_msg_free_locked(msg) lnet_msg_free(msg) - -#endif /* LNET_USE_LIB_FREELIST */ - lnet_libhandle_t *lnet_res_lh_lookup(struct lnet_res_container *rec, __u64 cookie); void lnet_res_lh_initialize(struct lnet_res_container *rec, @@ -467,7 +264,6 @@ void lnet_res_lh_initialize(struct lnet_res_container *rec, static inline void lnet_res_lh_invalidate(lnet_libhandle_t *lh) { - /* ALWAYS called with resource lock held */ /* NB: cookie is still useful, don't reset it */ list_del(&lh->lh_hash_chain); } @@ -486,7 +282,6 @@ lnet_eq2handle(lnet_handle_eq_t *handle, lnet_eq_t *eq) static inline lnet_eq_t * lnet_handle2eq(lnet_handle_eq_t *handle) { - /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; lh = lnet_res_lh_lookup(&the_lnet.ln_eq_container, handle->cookie); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 5053766..41827a0 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -280,20 +280,6 @@ typedef struct lnet_libmd { #define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) #define LNET_MD_FLAG_ABORTED (1 << 2) -#ifdef LNET_USE_LIB_FREELIST -typedef struct { - void *fl_objs; /* single contiguous array of objects */ - int fl_nobjs; /* the number of them */ - int fl_objsize; /* the size (including overhead) of each of them */ - struct list_head fl_list; /* where they are enqueued */ -} lnet_freelist_t; - -typedef struct { - struct list_head fo_list; /* enqueue on fl_list */ - void *fo_contents; /* aligned contents */ -} lnet_freeobj_t; -#endif - typedef struct { /* info about peers we are trying to fail */ struct list_head tp_list; /* ln_test_peers */ @@ -639,9 +625,6 @@ struct lnet_res_container { __u64 rec_lh_cookie; /* cookie generator */ struct list_head rec_active; /* active resource list */ struct list_head *rec_lh_hash; /* handle hash */ -#ifdef LNET_USE_LIB_FREELIST - lnet_freelist_t rec_freelist; /* freelist for resources */ -#endif }; /* message container */ @@ -654,9 +637,6 @@ struct lnet_msg_container { struct list_head msc_active; /* active message list */ /* threads doing finalization */ void **msc_finalizers; -#ifdef LNET_USE_LIB_FREELIST - lnet_freelist_t msc_freelist; /* freelist for messages */ -#endif }; /* Router Checker states */ diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 2230eb0..0740ab9 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -356,56 +356,6 @@ lnet_counters_reset(void) } EXPORT_SYMBOL(lnet_counters_reset); -#ifdef LNET_USE_LIB_FREELIST - -int -lnet_freelist_init(lnet_freelist_t *fl, int n, int size) -{ - char *space; - - LASSERT(n > 0); - - size += offsetof(lnet_freeobj_t, fo_contents); - - LIBCFS_ALLOC(space, n * size); - if (space == NULL) - return -ENOMEM; - - INIT_LIST_HEAD(&fl->fl_list); - fl->fl_objs = space; - fl->fl_nobjs = n; - fl->fl_objsize = size; - - do { - memset(space, 0, size); - list_add((struct list_head *)space, &fl->fl_list); - space += size; - } while (--n != 0); - - return 0; -} - -void -lnet_freelist_fini(lnet_freelist_t *fl) -{ - struct list_head *el; - int count; - - if (fl->fl_nobjs == 0) - return; - - count = 0; - for (el = fl->fl_list.next; el != &fl->fl_list; el = el->next) - count++; - - LASSERT(count == fl->fl_nobjs); - - LIBCFS_FREE(fl->fl_objs, fl->fl_nobjs * fl->fl_objsize); - memset(fl, 0, sizeof(*fl)); -} - -#endif /* LNET_USE_LIB_FREELIST */ - static __u64 lnet_create_interface_cookie(void) { @@ -462,9 +412,6 @@ lnet_res_container_cleanup(struct lnet_res_container *rec) count, lnet_res_type2str(rec->rec_type)); } -#ifdef LNET_USE_LIB_FREELIST - lnet_freelist_fini(&rec->rec_freelist); -#endif if (rec->rec_lh_hash != NULL) { LIBCFS_FREE(rec->rec_lh_hash, LNET_LH_HASH_SIZE * sizeof(rec->rec_lh_hash[0])); @@ -485,13 +432,6 @@ lnet_res_container_setup(struct lnet_res_container *rec, rec->rec_type = type; INIT_LIST_HEAD(&rec->rec_active); - -#ifdef LNET_USE_LIB_FREELIST - memset(&rec->rec_freelist, 0, sizeof(rec->rec_freelist)); - rc = lnet_freelist_init(&rec->rec_freelist, objnum, objsz); - if (rc != 0) - goto out; -#endif rec->rec_lh_cookie = (cpt << LNET_COOKIE_TYPE_BITS) | type; /* Arbitrary choice of hash table size */ @@ -635,13 +575,11 @@ lnet_prepare(lnet_pid_t requested_pid) goto failed; rc = lnet_res_container_setup(&the_lnet.ln_eq_container, 0, - LNET_COOKIE_TYPE_EQ, LNET_FL_MAX_EQS, - sizeof(lnet_eq_t)); + LNET_COOKIE_TYPE_EQ, 0, 0); if (rc != 0) goto failed; - recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, LNET_FL_MAX_MES, - sizeof(lnet_me_t)); + recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, 0, 0); if (recs == NULL) { rc = -ENOMEM; goto failed; @@ -649,8 +587,7 @@ lnet_prepare(lnet_pid_t requested_pid) the_lnet.ln_me_containers = recs; - recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD, LNET_FL_MAX_MDS, - sizeof(lnet_libmd_t)); + recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD, 0, 0); if (recs == NULL) { rc = -ENOMEM; goto failed; diff --git a/drivers/staging/lustre/lnet/lnet/lib-eq.c b/drivers/staging/lustre/lnet/lnet/lib-eq.c index 28858fb..f19ce9a 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-eq.c +++ b/drivers/staging/lustre/lnet/lnet/lib-eq.c @@ -191,7 +191,7 @@ LNetEQFree(lnet_handle_eq_t eqh) lnet_res_lh_invalidate(&eq->eq_lh); list_del(&eq->eq_list); - lnet_eq_free_locked(eq); + lnet_eq_free(eq); out: lnet_eq_wait_unlock(); lnet_res_unlock(LNET_LOCK_EX); diff --git a/drivers/staging/lustre/lnet/lnet/lib-md.c b/drivers/staging/lustre/lnet/lnet/lib-md.c index 5856c30..758f5be 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-md.c +++ b/drivers/staging/lustre/lnet/lnet/lib-md.c @@ -82,7 +82,7 @@ lnet_md_unlink(lnet_libmd_t *md) LASSERT(!list_empty(&md->md_list)); list_del_init(&md->md_list); - lnet_md_free_locked(md); + lnet_md_free(md); } static int @@ -320,7 +320,7 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, return 0; failed: - lnet_md_free_locked(md); + lnet_md_free(md); lnet_res_unlock(cpt); return rc; @@ -381,7 +381,7 @@ LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle) return 0; failed: - lnet_md_free_locked(md); + lnet_md_free(md); lnet_res_unlock(cpt); return rc; diff --git a/drivers/staging/lustre/lnet/lnet/lib-me.c b/drivers/staging/lustre/lnet/lnet/lib-me.c index 09e9008..42fc99e 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-me.c +++ b/drivers/staging/lustre/lnet/lnet/lib-me.c @@ -172,7 +172,7 @@ LNetMEInsert(lnet_handle_me_t current_meh, current_me = lnet_handle2me(¤t_meh); if (current_me == NULL) { - lnet_me_free_locked(new_me); + lnet_me_free(new_me); lnet_res_unlock(cpt); return -ENOENT; @@ -183,7 +183,7 @@ LNetMEInsert(lnet_handle_me_t current_meh, ptl = the_lnet.ln_portals[current_me->me_portal]; if (lnet_ptl_is_unique(ptl)) { /* nosense to insertion on unique portal */ - lnet_me_free_locked(new_me); + lnet_me_free(new_me); lnet_res_unlock(cpt); return -EPERM; } @@ -276,7 +276,7 @@ lnet_me_unlink(lnet_me_t *me) } lnet_res_lh_invalidate(&me->me_lh); - lnet_me_free_locked(me); + lnet_me_free(me); } #if 0 diff --git a/drivers/staging/lustre/lnet/lnet/lib-msg.c b/drivers/staging/lustre/lnet/lnet/lib-msg.c index 65d7595..43977e8 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-msg.c +++ b/drivers/staging/lustre/lnet/lnet/lib-msg.c @@ -427,7 +427,7 @@ lnet_complete_msg_locked(lnet_msg_t *msg, int cpt) } lnet_msg_decommit(msg, cpt, status); - lnet_msg_free_locked(msg); + lnet_msg_free(msg); return 0; } -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 20:43:21 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:21 -0400 Subject: [lustre-devel] [PATCH v3 2/8] staging:lustre: fixup LNet resource container api In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-3-git-send-email-jsimmons@infradead.org> Both lnet_res_container_setup and lnet_res_container_create have additional parameters that are no longer used with the removal of the FREELIST code. This patch removes the no longer needed function arguments. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/api-ni.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 0740ab9..9fc3bf6 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -422,8 +422,7 @@ lnet_res_container_cleanup(struct lnet_res_container *rec) } static int -lnet_res_container_setup(struct lnet_res_container *rec, - int cpt, int type, int objnum, int objsz) +lnet_res_container_setup(struct lnet_res_container *rec, int cpt, int type) { int rc = 0; int i; @@ -467,7 +466,7 @@ lnet_res_containers_destroy(struct lnet_res_container **recs) } static struct lnet_res_container ** -lnet_res_containers_create(int type, int objnum, int objsz) +lnet_res_containers_create(int type) { struct lnet_res_container **recs; struct lnet_res_container *rec; @@ -482,7 +481,7 @@ lnet_res_containers_create(int type, int objnum, int objsz) } cfs_percpt_for_each(rec, i, recs) { - rc = lnet_res_container_setup(rec, i, type, objnum, objsz); + rc = lnet_res_container_setup(rec, i, type); if (rc != 0) { lnet_res_containers_destroy(recs); return NULL; @@ -575,11 +574,11 @@ lnet_prepare(lnet_pid_t requested_pid) goto failed; rc = lnet_res_container_setup(&the_lnet.ln_eq_container, 0, - LNET_COOKIE_TYPE_EQ, 0, 0); + LNET_COOKIE_TYPE_EQ); if (rc != 0) goto failed; - recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, 0, 0); + recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME); if (recs == NULL) { rc = -ENOMEM; goto failed; @@ -587,7 +586,7 @@ lnet_prepare(lnet_pid_t requested_pid) the_lnet.ln_me_containers = recs; - recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD, 0, 0); + recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD); if (recs == NULL) { rc = -ENOMEM; goto failed; -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 20:43:27 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:27 -0400 Subject: [lustre-devel] [PATCH v3 8/8] staging:lustre: Update license and copyright for the LNET headers In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-9-git-send-email-jsimmons@infradead.org> Point to the right place for GNU license. Update Intel copyright. Signed-off-by: James Simmons + * Author: Liang Zhen */ #ifndef __LNET_ST_H__ diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 8eaed1a..a627be9 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -23,10 +23,11 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2014, Intel Corporation. + * Copyright (c) 2011 - 2015, Intel Corporation. */ #ifndef _LNET_NIDSTRINGS_H #define _LNET_NIDSTRINGS_H + #include "types.h" /** diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 4c790bd..599c9f6 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -15,25 +15,21 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. * * lnet/include/lnet/socklnd.h - * - * #defines shared between socknal implementation and utilities */ #ifndef __LNET_LNET_SOCKLND_H__ #define __LNET_LNET_SOCKLND_H__ diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 00a42f8..259aedd 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,11 +23,11 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. */ #ifndef __LNET_TYPES_H__ -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 20:43:26 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:26 -0400 Subject: [lustre-devel] [PATCH v3 7/8] staging:lustre: style cleanups for LNet headers In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-8-git-send-email-jsimmons@infradead.org> Handle all the style issues reported by checkpatch.pl. Remove general white spaces, alignmemnts etc. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/api.h | 32 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 36 +- .../staging/lustre/include/linux/lnet/lib-types.h | 315 +++++++------ drivers/staging/lustre/include/linux/lnet/lnetst.h | 473 +++++++++++--------- .../staging/lustre/include/linux/lnet/socklnd.h | 55 ++-- drivers/staging/lustre/include/linux/lnet/types.h | 76 ++-- 6 files changed, 522 insertions(+), 465 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index dee7f27..2eb0a05 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -95,16 +95,16 @@ void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle); * @{ */ int LNetMEAttach(unsigned int portal, lnet_process_id_t match_id_in, - __u64 match_bits_in, - __u64 ignore_bits_in, + __u64 match_bits_in, + __u64 ignore_bits_in, lnet_unlink_t unlink_in, lnet_ins_pos_t pos_in, lnet_handle_me_t *handle_out); int LNetMEInsert(lnet_handle_me_t current_in, lnet_process_id_t match_id_in, - __u64 match_bits_in, - __u64 ignore_bits_in, + __u64 match_bits_in, + __u64 ignore_bits_in, lnet_unlink_t unlink_in, lnet_ins_pos_t position_in, lnet_handle_me_t *handle_out); @@ -125,13 +125,13 @@ int LNetMEUnlink(lnet_handle_me_t current_in); * associated with a MD: LNetMDUnlink(). * @{ */ int LNetMDAttach(lnet_handle_me_t current_in, - lnet_md_t md_in, + lnet_md_t md_in, lnet_unlink_t unlink_in, lnet_handle_md_t *handle_out); -int LNetMDBind(lnet_md_t md_in, - lnet_unlink_t unlink_in, - lnet_handle_md_t *handle_out); +int LNetMDBind(lnet_md_t md_in, + lnet_unlink_t unlink_in, + lnet_handle_md_t *handle_out); int LNetMDUnlink(lnet_handle_md_t md_in); /** @} lnet_md */ @@ -171,10 +171,10 @@ int LNetEQWait(lnet_handle_eq_t eventq_in, lnet_event_t *event_out); int LNetEQPoll(lnet_handle_eq_t *eventqs_in, - int neq_in, - int timeout_ms, + int neq_in, + int timeout_ms, lnet_event_t *event_out, - int *which_eq_out); + int *which_eq_out); /** @} lnet_eq */ /** \defgroup lnet_data Data movement operations @@ -182,20 +182,20 @@ int LNetEQPoll(lnet_handle_eq_t *eventqs_in, * The LNet API provides two data movement operations: LNetPut() * and LNetGet(). * @{ */ -int LNetPut(lnet_nid_t self, +int LNetPut(lnet_nid_t self, lnet_handle_md_t md_in, lnet_ack_req_t ack_req_in, lnet_process_id_t target_in, unsigned int portal_in, - __u64 match_bits_in, + __u64 match_bits_in, unsigned int offset_in, - __u64 hdr_data_in); + __u64 hdr_data_in); -int LNetGet(lnet_nid_t self, +int LNetGet(lnet_nid_t self, lnet_handle_md_t md_in, lnet_process_id_t target_in, unsigned int portal_in, - __u64 match_bits_in, + __u64 match_bits_in, unsigned int offset_in); /** @} lnet_data */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 15e6a2e..982b3ad 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -44,29 +44,29 @@ #include "lnet.h" #include "lib-types.h" -extern lnet_t the_lnet; /* THE network */ +extern lnet_t the_lnet; /* THE network */ #if (BITS_PER_LONG == 32) /* 2 CPTs, allowing more CPTs might make us under memory pressure */ -# define LNET_CPT_MAX_BITS 1 +#define LNET_CPT_MAX_BITS 1 #else /* 64-bit system */ /* * 256 CPTs for thousands of CPUs, allowing more CPTs might make us * under risk of consuming all lh_cookie. */ -# define LNET_CPT_MAX_BITS 8 +#define LNET_CPT_MAX_BITS 8 #endif /* BITS_PER_LONG == 32 */ /* max allowed CPT number */ -#define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS) +#define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS) -#define LNET_CPT_NUMBER (the_lnet.ln_cpt_number) -#define LNET_CPT_BITS (the_lnet.ln_cpt_bits) -#define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1) +#define LNET_CPT_NUMBER (the_lnet.ln_cpt_number) +#define LNET_CPT_BITS (the_lnet.ln_cpt_bits) +#define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1) /** exclusive lock */ -#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX +#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX static inline int lnet_is_wire_handle_none(lnet_handle_wire_t *wh) { @@ -163,7 +163,7 @@ lnet_net_lock_current(void) #define lnet_ni_lock(ni) spin_lock(&(ni)->ni_lock) #define lnet_ni_unlock(ni) spin_unlock(&(ni)->ni_lock) -#define MAX_PORTALS 64 +#define MAX_PORTALS 64 static inline lnet_eq_t * lnet_eq_alloc(void) @@ -184,8 +184,8 @@ static inline lnet_libmd_t * lnet_md_alloc(lnet_md_t *umd) { lnet_libmd_t *md; - unsigned int size; - unsigned int niov; + unsigned int size; + unsigned int niov; if ((umd->options & LNET_MD_KIOV) != 0) { niov = umd->length; @@ -211,7 +211,7 @@ lnet_md_alloc(lnet_md_t *umd) static inline void lnet_md_free(lnet_libmd_t *md) { - unsigned int size; + unsigned int size; if ((md->md_options & LNET_MD_KIOV) != 0) size = offsetof(lnet_libmd_t, md_iov.kiov[md->md_niov]); @@ -299,7 +299,7 @@ lnet_handle2md(lnet_handle_md_t *handle) { /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; - int cpt; + int cpt; cpt = lnet_cpt_of_cookie(handle->cookie); lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt], @@ -315,7 +315,7 @@ lnet_wire_handle2md(lnet_handle_wire_t *wh) { /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; - int cpt; + int cpt; if (wh->wh_interface_cookie != the_lnet.ln_interface_cookie) return NULL; @@ -340,7 +340,7 @@ lnet_handle2me(lnet_handle_me_t *handle) { /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; - int cpt; + int cpt; cpt = lnet_cpt_of_cookie(handle->cookie); lh = lnet_res_lh_lookup(the_lnet.ln_me_containers[cpt], @@ -530,7 +530,9 @@ void lnet_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, unsigned int offset, unsigned int mlen, unsigned int rlen); lnet_msg_t *lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *get_msg); void lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *msg, unsigned int len); + void lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int rc); + void lnet_drop_delayed_msg_list(struct list_head *head, char *reason); void lnet_recv_delayed_msg_list(struct list_head *head); @@ -680,12 +682,12 @@ void lnet_peer_tables_destroy(void); int lnet_peer_tables_create(void); void lnet_debug_peer(lnet_nid_t nid); -static inline void lnet_peer_set_alive(lnet_peer_t *lp) +static inline void +lnet_peer_set_alive(lnet_peer_t *lp) { lp->lp_last_alive = lp->lp_last_query = get_seconds(); if (!lp->lp_alive) lnet_notify_locked(lp, 0, 1, lp->lp_last_alive); } - #endif diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 8e8e725..adf3286 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -54,17 +54,17 @@ #if (LNET_MAX_PAYLOAD < LNET_MTU) # error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb" #elif (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV)) -# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" +# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" #endif /* forward refs */ struct lnet_libmd; typedef struct lnet_msg { - struct list_head msg_activelist; - struct list_head msg_list; /* Q for credits/MD */ + struct list_head msg_activelist; + struct list_head msg_list; /* Q for credits/MD */ - lnet_process_id_t msg_target; + lnet_process_id_t msg_target; /* where is it from, it's only for building event */ lnet_nid_t msg_from; __u32 msg_type; @@ -84,45 +84,46 @@ typedef struct lnet_msg { /* ready for pending on RX delay list */ unsigned int msg_rx_ready_delay:1; - unsigned int msg_vmflush:1; /* VM trying to free memory */ - unsigned int msg_target_is_router:1; /* sending to a router */ - unsigned int msg_routing:1; /* being forwarded */ - unsigned int msg_ack:1; /* ack on finalize (PUT) */ - unsigned int msg_sending:1; /* outgoing message */ - unsigned int msg_receiving:1; /* being received */ - unsigned int msg_txcredit:1; /* taken an NI send credit */ - unsigned int msg_peertxcredit:1; /* taken a peer send credit */ - unsigned int msg_rtrcredit:1; /* taken a global router credit */ - unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ - unsigned int msg_onactivelist:1; /* on the activelist */ - - struct lnet_peer *msg_txpeer; /* peer I'm sending to */ - struct lnet_peer *msg_rxpeer; /* peer I received from */ - - void *msg_private; - struct lnet_libmd *msg_md; - - unsigned int msg_len; - unsigned int msg_wanted; - unsigned int msg_offset; - unsigned int msg_niov; - struct kvec *msg_iov; - lnet_kiov_t *msg_kiov; - - lnet_event_t msg_ev; - lnet_hdr_t msg_hdr; + unsigned int msg_vmflush:1; /* VM trying to free memory */ + unsigned int msg_target_is_router:1; /* sending to a router */ + unsigned int msg_routing:1; /* being forwarded */ + unsigned int msg_ack:1; /* ack on finalize (PUT) */ + unsigned int msg_sending:1; /* outgoing message */ + unsigned int msg_receiving:1; /* being received */ + unsigned int msg_txcredit:1; /* taken an NI send credit */ + unsigned int msg_peertxcredit:1; /* taken a peer send credit */ + unsigned int msg_rtrcredit:1; /* taken a global + router credit */ + unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ + unsigned int msg_onactivelist:1; /* on the activelist */ + + struct lnet_peer *msg_txpeer; /* peer I'm sending to */ + struct lnet_peer *msg_rxpeer; /* peer I received from */ + + void *msg_private; + struct lnet_libmd *msg_md; + + unsigned int msg_len; + unsigned int msg_wanted; + unsigned int msg_offset; + unsigned int msg_niov; + struct kvec *msg_iov; + lnet_kiov_t *msg_kiov; + + lnet_event_t msg_ev; + lnet_hdr_t msg_hdr; } lnet_msg_t; typedef struct lnet_libhandle { - struct list_head lh_hash_chain; - __u64 lh_cookie; + struct list_head lh_hash_chain; + __u64 lh_cookie; } lnet_libhandle_t; #define lh_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(char *)(&((type *)0)->member))) typedef struct lnet_eq { - struct list_head eq_list; + struct list_head eq_list; lnet_libhandle_t eq_lh; lnet_seq_t eq_enq_seq; lnet_seq_t eq_deq_seq; @@ -133,61 +134,61 @@ typedef struct lnet_eq { } lnet_eq_t; typedef struct lnet_me { - struct list_head me_list; - lnet_libhandle_t me_lh; - lnet_process_id_t me_match_id; - unsigned int me_portal; - unsigned int me_pos; /* hash offset in mt_hash */ - __u64 me_match_bits; - __u64 me_ignore_bits; - lnet_unlink_t me_unlink; - struct lnet_libmd *me_md; + struct list_head me_list; + lnet_libhandle_t me_lh; + lnet_process_id_t me_match_id; + unsigned int me_portal; + unsigned int me_pos; /* hash offset in mt_hash */ + __u64 me_match_bits; + __u64 me_ignore_bits; + lnet_unlink_t me_unlink; + struct lnet_libmd *me_md; } lnet_me_t; typedef struct lnet_libmd { - struct list_head md_list; - lnet_libhandle_t md_lh; - lnet_me_t *md_me; - char *md_start; - unsigned int md_offset; - unsigned int md_length; - unsigned int md_max_size; - int md_threshold; - int md_refcount; - unsigned int md_options; - unsigned int md_flags; - void *md_user_ptr; - lnet_eq_t *md_eq; - unsigned int md_niov; /* # frags */ + struct list_head md_list; + lnet_libhandle_t md_lh; + lnet_me_t *md_me; + char *md_start; + unsigned int md_offset; + unsigned int md_length; + unsigned int md_max_size; + int md_threshold; + int md_refcount; + unsigned int md_options; + unsigned int md_flags; + void *md_user_ptr; + lnet_eq_t *md_eq; + unsigned int md_niov; /* # frags */ union { - struct kvec iov[LNET_MAX_IOV]; - lnet_kiov_t kiov[LNET_MAX_IOV]; + struct kvec iov[LNET_MAX_IOV]; + lnet_kiov_t kiov[LNET_MAX_IOV]; } md_iov; } lnet_libmd_t; -#define LNET_MD_FLAG_ZOMBIE (1 << 0) -#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) -#define LNET_MD_FLAG_ABORTED (1 << 2) +#define LNET_MD_FLAG_ZOMBIE (1 << 0) +#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) +#define LNET_MD_FLAG_ABORTED (1 << 2) typedef struct { /* info about peers we are trying to fail */ - struct list_head tp_list; /* ln_test_peers */ - lnet_nid_t tp_nid; /* matching nid */ - unsigned int tp_threshold; /* # failures to simulate */ + struct list_head tp_list; /* ln_test_peers */ + lnet_nid_t tp_nid; /* matching nid */ + unsigned int tp_threshold; /* # failures to simulate */ } lnet_test_peer_t; -#define LNET_COOKIE_TYPE_MD 1 -#define LNET_COOKIE_TYPE_ME 2 -#define LNET_COOKIE_TYPE_EQ 3 -#define LNET_COOKIE_TYPE_BITS 2 +#define LNET_COOKIE_TYPE_MD 1 +#define LNET_COOKIE_TYPE_ME 2 +#define LNET_COOKIE_TYPE_EQ 3 +#define LNET_COOKIE_TYPE_BITS 2 #define LNET_COOKIE_MASK ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL) -struct lnet_ni; /* forward ref */ +struct lnet_ni; /* forward ref */ typedef struct lnet_lnd { /* fields managed by portals */ - struct list_head lnd_list; /* stash in the LND table */ - int lnd_refcount; /* # active instances */ + struct list_head lnd_list; /* stash in the LND table */ + int lnd_refcount; /* # active instances */ /* fields initialised by the LND */ __u32 lnd_type; @@ -222,7 +223,8 @@ typedef struct lnet_lnd { int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, - unsigned int offset, unsigned int mlen, unsigned int rlen); + unsigned int offset, unsigned int mlen, + unsigned int rlen); /* lnet_parse() has had to delay processing of this message * (e.g. waiting for a forwarding buffer or send credits). Give the @@ -230,31 +232,31 @@ typedef struct lnet_lnd { * for success and do NOT give back a receive credit; that has to wait * until lnd_recv() gets called. On failure return < 0 and * release resources; lnd_recv() will not be called. */ - int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, - void **new_privatep); + int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, + lnet_msg_t *msg, void **new_privatep); /* notification of peer health */ void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive); /* query of peer aliveness */ - void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer, unsigned long *when); + void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer, + unsigned long *when); /* accept a new connection */ int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock); - } lnd_t; struct lnet_tx_queue { int tq_credits; /* # tx credits free */ int tq_credits_min; /* lowest it's been */ int tq_credits_max; /* total # tx credits */ - struct list_head tq_delayed; /* delayed TXs */ + struct list_head tq_delayed; /* delayed TXs */ }; typedef struct lnet_ni { spinlock_t ni_lock; - struct list_head ni_list; /* chain on ln_nis */ - struct list_head ni_cptlist; /* chain on ln_nis_cpt */ + struct list_head ni_list; /* chain on ln_nis */ + struct list_head ni_cptlist; /* chain on ln_nis_cpt */ int ni_maxtxcredits; /* # tx credits */ /* # per-peer send credits */ int ni_peertxcredits; @@ -291,55 +293,65 @@ typedef struct lnet_ni { #define LNET_PINGINFO_SIZE offsetof(lnet_ping_info_t, pi_ni[LNET_MAX_RTR_NIS]) typedef struct { /* chain on the_lnet.ln_zombie_rcd or ln_deathrow_rcd */ - struct list_head rcd_list; + struct list_head rcd_list; lnet_handle_md_t rcd_mdh; /* ping buffer MD */ struct lnet_peer *rcd_gateway; /* reference to gateway */ lnet_ping_info_t *rcd_pinginfo; /* ping buffer */ } lnet_rc_data_t; typedef struct lnet_peer { - struct list_head lp_hashlist; /* chain on peer hash */ - struct list_head lp_txq; /* messages blocking for tx credits */ - struct list_head lp_rtrq; /* messages blocking for router credits */ - struct list_head lp_rtr_list; /* chain on router list */ - int lp_txcredits; /* # tx credits available */ - int lp_mintxcredits; /* low water mark */ - int lp_rtrcredits; /* # router credits */ - int lp_minrtrcredits; /* low water mark */ - unsigned int lp_alive:1; /* alive/dead? */ - unsigned int lp_notify:1; /* notification outstanding? */ - unsigned int lp_notifylnd:1; /* outstanding notification for LND? */ - unsigned int lp_notifying:1; /* some thread is handling notification */ - unsigned int lp_ping_notsent; /* SEND event outstanding from ping */ - int lp_alive_count; /* # times router went dead<->alive */ - long lp_txqnob; /* bytes queued for sending */ - unsigned long lp_timestamp; /* time of last aliveness news */ - unsigned long lp_ping_timestamp; /* time of last ping attempt */ - unsigned long lp_ping_deadline; /* != 0 if ping reply expected */ - unsigned long lp_last_alive; /* when I was last alive */ - unsigned long lp_last_query; /* when lp_ni was queried last time */ - lnet_ni_t *lp_ni; /* interface peer is on */ - lnet_nid_t lp_nid; /* peer's NID */ - int lp_refcount; /* # refs */ + struct list_head lp_hashlist; /* chain on peer hash */ + struct list_head lp_txq; /* messages blocking for + tx credits */ + struct list_head lp_rtrq; /* messages blocking for + router credits */ + struct list_head lp_rtr_list; /* chain on router list */ + int lp_txcredits; /* # tx credits available */ + int lp_mintxcredits;/* low water mark */ + int lp_rtrcredits; /* # router credits */ + int lp_minrtrcredits; /* low water mark */ + unsigned int lp_alive:1; /* alive/dead? */ + unsigned int lp_notify:1; /* notification outstanding? */ + unsigned int lp_notifylnd:1; /* outstanding notification + for LND? */ + unsigned int lp_notifying:1; /* some thread is handling + notification */ + unsigned int lp_ping_notsent;/* SEND event outstanding + from ping */ + int lp_alive_count; /* # times router went + dead<->alive */ + long lp_txqnob; /* bytes queued for sending */ + unsigned long lp_timestamp; /* time of last aliveness + news */ + unsigned long lp_ping_timestamp;/* time of last ping + attempt */ + unsigned long lp_ping_deadline; /* != 0 if ping reply + expected */ + unsigned long lp_last_alive; /* when I was last alive */ + unsigned long lp_last_query; /* when lp_ni was queried + last time */ + lnet_ni_t *lp_ni; /* interface peer is on */ + lnet_nid_t lp_nid; /* peer's NID */ + int lp_refcount; /* # refs */ int lp_cpt; /* CPT this peer attached on */ /* # refs from lnet_route_t::lr_gateway */ int lp_rtr_refcount; /* returned RC ping features */ unsigned int lp_ping_feats; - struct list_head lp_routes; /* routers on this peer */ + struct list_head lp_routes; /* routers on this peer */ lnet_rc_data_t *lp_rcd; /* router checker state */ } lnet_peer_t; /* peer hash size */ -#define LNET_PEER_HASH_BITS 9 -#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS) +#define LNET_PEER_HASH_BITS 9 +#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS) /* peer hash table */ struct lnet_peer_table { int pt_version; /* /proc validity stamp */ int pt_number; /* # peers extant */ - struct list_head pt_deathrow; /* zombie peers */ - struct list_head *pt_hash; /* NID->peer hash */ + struct list_head pt_deathrow; /* zombie peers */ + struct list_head *pt_hash; /* NID->peer hash */ }; /* peer aliveness is enabled only on routers for peers in a network where the @@ -348,8 +360,8 @@ struct lnet_peer_table { (lp)->lp_ni->ni_peertimeout > 0) typedef struct { - struct list_head lr_list; /* chain on net */ - struct list_head lr_gwlist; /* chain on gateway */ + struct list_head lr_list; /* chain on net */ + struct list_head lr_gwlist; /* chain on gateway */ lnet_peer_t *lr_gateway; /* router node */ __u32 lr_net; /* remote network number */ int lr_seq; /* sequence for round-robin */ @@ -363,9 +375,10 @@ typedef struct { #define LNET_REMOTE_NETS_HASH_SIZE (1 << the_lnet.ln_remote_nets_hbits) typedef struct { - struct list_head lrn_list; /* chain on ln_remote_nets_hash */ - struct list_head lrn_routes; /* routes to me */ - __u32 lrn_net; /* my net number */ + struct list_head lrn_list; /* chain on + ln_remote_nets_hash */ + struct list_head lrn_routes; /* routes to me */ + __u32 lrn_net; /* my net number */ } lnet_remotenet_t; /** lnet message has credit and can be submitted to lnd for send/receive */ @@ -374,21 +387,23 @@ typedef struct { #define LNET_CREDIT_WAIT 1 typedef struct { - struct list_head rbp_bufs; /* my free buffer pool */ - struct list_head rbp_msgs; /* messages blocking for a buffer */ - int rbp_npages; /* # pages in each buffer */ - int rbp_nbuffers; /* # buffers */ - int rbp_credits; /* # free buffers / blocked messages */ - int rbp_mincredits; /* low water mark */ + struct list_head rbp_bufs; /* my free buffer pool */ + struct list_head rbp_msgs; /* messages blocking + for a buffer */ + int rbp_npages; /* # pages in each buffer */ + int rbp_nbuffers; /* # buffers */ + int rbp_credits; /* # free buffers / + blocked messages */ + int rbp_mincredits; /* low water mark */ } lnet_rtrbufpool_t; typedef struct { - struct list_head rb_list; /* chain on rbp_bufs */ - lnet_rtrbufpool_t *rb_pool; /* owning pool */ - lnet_kiov_t rb_kiov[0]; /* the buffer space */ + struct list_head rb_list; /* chain on rbp_bufs */ + lnet_rtrbufpool_t *rb_pool; /* owning pool */ + lnet_kiov_t rb_kiov[0]; /* the buffer space */ } lnet_rtrbuf_t; -#define LNET_PEER_HASHSIZE 503 /* prime! */ +#define LNET_PEER_HASHSIZE 503 /* prime! */ #define LNET_NRBPOOLS 3 /* # different router buffer pools */ @@ -400,15 +415,16 @@ enum { /* Must be discarded */ LNET_MATCHMD_DROP = (1 << 2), /* match and buffer is exhausted */ - LNET_MATCHMD_EXHAUSTED = (1 << 3), + LNET_MATCHMD_EXHAUSTED = (1 << 3), /* match or drop */ - LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP), + LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP), }; /* Options for lnet_portal_t::ptl_options */ -#define LNET_PTL_LAZY (1 << 0) -#define LNET_PTL_MATCH_UNIQUE (1 << 1) /* unique match, for RDMA */ -#define LNET_PTL_MATCH_WILDCARD (1 << 2) /* wildcard match, request portal */ +#define LNET_PTL_LAZY (1 << 0) +#define LNET_PTL_MATCH_UNIQUE (1 << 1) /* unique match, for RDMA */ +#define LNET_PTL_MATCH_WILDCARD (1 << 2) /* wildcard match, + request portal */ /* parameter for matching operations (GET, PUT) */ struct lnet_match_info { @@ -444,7 +460,7 @@ struct lnet_match_table { unsigned int mt_enabled; /* bitmap to flag whether MEs on mt_hash are exhausted or not */ __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP]; - struct list_head *mt_mhash; /* matching hash */ + struct list_head *mt_mhash; /* matching hash */ }; /* these are only useful for wildcard portal */ @@ -463,17 +479,17 @@ typedef struct lnet_portal { /* flags on this portal: lazy, unique... */ unsigned int ptl_options; /* list of messages which are stealing buffer */ - struct list_head ptl_msg_stealing; + struct list_head ptl_msg_stealing; /* messages blocking for MD */ - struct list_head ptl_msg_delayed; + struct list_head ptl_msg_delayed; /* Match table for each CPT */ struct lnet_match_table **ptl_mtables; /* spread rotor of incoming "PUT" */ unsigned int ptl_rotor; /* # active entries for this portal */ - int ptl_mt_nmaps; + int ptl_mt_nmaps; /* array of active entries' cpu-partition-id */ - int ptl_mt_maps[0]; + int ptl_mt_maps[0]; } lnet_portal_t; #define LNET_LH_HASH_BITS 12 @@ -484,8 +500,8 @@ typedef struct lnet_portal { struct lnet_res_container { unsigned int rec_type; /* container type */ __u64 rec_lh_cookie; /* cookie generator */ - struct list_head rec_active; /* active resource list */ - struct list_head *rec_lh_hash; /* handle hash */ + struct list_head rec_active; /* active resource list */ + struct list_head *rec_lh_hash; /* handle hash */ }; /* message container */ @@ -494,8 +510,8 @@ struct lnet_msg_container { /* max # threads finalizing */ int msc_nfinalizers; /* msgs waiting to complete finalizing */ - struct list_head msc_finalizing; - struct list_head msc_active; /* active message list */ + struct list_head msc_finalizing; + struct list_head msc_active; /* active message list */ /* threads doing finalization */ void **msc_finalizers; }; @@ -525,7 +541,7 @@ typedef struct { /* Event Queue container */ struct lnet_res_container ln_eq_container; - wait_queue_head_t ln_eq_waitq; + wait_queue_head_t ln_eq_waitq; spinlock_t ln_eq_wait_lock; unsigned int ln_remote_nets_hbits; @@ -536,23 +552,23 @@ typedef struct { lnet_counters_t **ln_counters; struct lnet_peer_table **ln_peer_tables; /* failure simulation */ - struct list_head ln_test_peers; + struct list_head ln_test_peers; - struct list_head ln_nis; /* LND instances */ + struct list_head ln_nis; /* LND instances */ /* NIs bond on specific CPT(s) */ - struct list_head ln_nis_cpt; + struct list_head ln_nis_cpt; /* dying LND instances */ - struct list_head ln_nis_zombie; + struct list_head ln_nis_zombie; lnet_ni_t *ln_loni; /* the loopback NI */ /* NI to wait for events in */ lnet_ni_t *ln_eq_waitni; /* remote networks with routes to them */ - struct list_head *ln_remote_nets_hash; + struct list_head *ln_remote_nets_hash; /* validity stamp */ __u64 ln_remote_nets_version; /* list of all known routers */ - struct list_head ln_routers; + struct list_head ln_routers; /* validity stamp */ __u64 ln_routers_version; /* percpt router buffer pools */ @@ -567,15 +583,16 @@ typedef struct { /* router checker's event queue */ lnet_handle_eq_t ln_rc_eqh; /* rcd still pending on net */ - struct list_head ln_rcd_deathrow; + struct list_head ln_rcd_deathrow; /* rcd ready for free */ - struct list_head ln_rcd_zombie; + struct list_head ln_rcd_zombie; /* serialise startup/shutdown */ struct semaphore ln_rc_signal; struct mutex ln_api_mutex; struct mutex ln_lnd_mutex; - int ln_init; /* lnet_init() called? */ + int ln_init; /* lnet_init() + called? */ /* Have I called LNetNIInit myself? */ int ln_niinit_self; /* LNetNIInit/LNetNIFini counter */ @@ -588,7 +605,7 @@ typedef struct { /* uniquely identifies this ni in this epoch */ __u64 ln_interface_cookie; /* registered LNDs */ - struct list_head ln_lnds; + struct list_head ln_lnds; /* space for network names */ char *ln_network_tokens; diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 57432fd..e7ae40b 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -49,99 +49,107 @@ #define LST_FEATS_EMPTY (LST_FEAT_NONE) #define LST_FEATS_MASK (LST_FEAT_NONE | LST_FEAT_BULK_LEN) -#define LST_NAME_SIZE 32 /* max name buffer length */ - -#define LSTIO_DEBUG 0xC00 /* debug */ -#define LSTIO_SESSION_NEW 0xC01 /* create session */ -#define LSTIO_SESSION_END 0xC02 /* end session */ -#define LSTIO_SESSION_INFO 0xC03 /* query session */ -#define LSTIO_GROUP_ADD 0xC10 /* add group */ -#define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */ -#define LSTIO_GROUP_INFO 0xC12 /* query default information of specified group */ -#define LSTIO_GROUP_DEL 0xC13 /* delete group */ -#define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */ -#define LSTIO_GROUP_UPDATE 0xC15 /* update group */ -#define LSTIO_BATCH_ADD 0xC20 /* add batch */ -#define LSTIO_BATCH_START 0xC21 /* start batch */ -#define LSTIO_BATCH_STOP 0xC22 /* stop batch */ -#define LSTIO_BATCH_DEL 0xC23 /* delete batch */ -#define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */ -#define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */ -#define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */ -#define LSTIO_BATCH_QUERY 0xC27 /* query batch status */ -#define LSTIO_STAT_QUERY 0xC30 /* get stats */ - -typedef struct { - lnet_nid_t ses_nid; /* nid of console node */ - __u64 ses_stamp; /* time stamp */ -} lst_sid_t; /*** session id */ +#define LST_NAME_SIZE 32 /* max name buffer length */ + +#define LSTIO_DEBUG 0xC00 /* debug */ +#define LSTIO_SESSION_NEW 0xC01 /* create session */ +#define LSTIO_SESSION_END 0xC02 /* end session */ +#define LSTIO_SESSION_INFO 0xC03 /* query session */ +#define LSTIO_GROUP_ADD 0xC10 /* add group */ +#define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */ +#define LSTIO_GROUP_INFO 0xC12 /* query default information of + * specified group */ +#define LSTIO_GROUP_DEL 0xC13 /* delete group */ +#define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */ +#define LSTIO_GROUP_UPDATE 0xC15 /* update group */ +#define LSTIO_BATCH_ADD 0xC20 /* add batch */ +#define LSTIO_BATCH_START 0xC21 /* start batch */ +#define LSTIO_BATCH_STOP 0xC22 /* stop batch */ +#define LSTIO_BATCH_DEL 0xC23 /* delete batch */ +#define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */ +#define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */ +#define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */ +#define LSTIO_BATCH_QUERY 0xC27 /* query batch status */ +#define LSTIO_STAT_QUERY 0xC30 /* get stats */ + +typedef struct { + lnet_nid_t ses_nid; /* nid of console node */ + __u64 ses_stamp; /* time stamp */ +} lst_sid_t; /*** session id */ extern lst_sid_t LST_INVALID_SID; typedef struct { - __u64 bat_id; /* unique id in session */ -} lst_bid_t; /*** batch id (group of tests) */ + __u64 bat_id; /* unique id in session */ +} lst_bid_t; /*** batch id (group of tests) */ /* Status of test node */ -#define LST_NODE_ACTIVE 0x1 /* node in this session */ -#define LST_NODE_BUSY 0x2 /* node is taken by other session */ -#define LST_NODE_DOWN 0x4 /* node is down */ -#define LST_NODE_UNKNOWN 0x8 /* node not in session */ +#define LST_NODE_ACTIVE 0x1 /* node in this session */ +#define LST_NODE_BUSY 0x2 /* node is taken by other session */ +#define LST_NODE_DOWN 0x4 /* node is down */ +#define LST_NODE_UNKNOWN 0x8 /* node not in session */ typedef struct { - lnet_process_id_t nde_id; /* id of node */ - int nde_state; /* state of node */ -} lstcon_node_ent_t; /*** node entry, for list_group command */ + lnet_process_id_t nde_id; /* id of node */ + int nde_state; /* state of node */ +} lstcon_node_ent_t; /*** node entry, for list_group command */ typedef struct { - int nle_nnode; /* # of nodes */ - int nle_nactive; /* # of active nodes */ - int nle_nbusy; /* # of busy nodes */ - int nle_ndown; /* # of down nodes */ - int nle_nunknown; /* # of unknown nodes */ -} lstcon_ndlist_ent_t; /*** node_list entry, for list_batch command */ + int nle_nnode; /* # of nodes */ + int nle_nactive; /* # of active nodes */ + int nle_nbusy; /* # of busy nodes */ + int nle_ndown; /* # of down nodes */ + int nle_nunknown; /* # of unknown nodes */ +} lstcon_ndlist_ent_t; /*** node_list entry, for list_batch command */ typedef struct { - int tse_type; /* test type */ - int tse_loop; /* loop count */ - int tse_concur; /* concurrency of test */ -} lstcon_test_ent_t; /*** test summary entry, for list_batch command */ + int tse_type; /* test type */ + int tse_loop; /* loop count */ + int tse_concur; /* concurrency of test */ +} lstcon_test_ent_t; /*** test summary entry, for + *** list_batch command */ typedef struct { - int bae_state; /* batch status */ - int bae_timeout; /* batch timeout */ - int bae_ntest; /* # of tests in the batch */ -} lstcon_batch_ent_t; /*** batch summary entry, for list_batch command */ + int bae_state; /* batch status */ + int bae_timeout; /* batch timeout */ + int bae_ntest; /* # of tests in the batch */ +} lstcon_batch_ent_t; /*** batch summary entry, for + *** list_batch command */ typedef struct { - lstcon_ndlist_ent_t tbe_cli_nle; /* client (group) node_list entry */ - lstcon_ndlist_ent_t tbe_srv_nle; /* server (group) node_list entry */ + lstcon_ndlist_ent_t tbe_cli_nle; /* client (group) node_list + * entry */ + lstcon_ndlist_ent_t tbe_srv_nle; /* server (group) node_list + * entry */ union { - lstcon_test_ent_t tbe_test; /* test entry */ - lstcon_batch_ent_t tbe_batch; /* batch entry */ + lstcon_test_ent_t tbe_test; /* test entry */ + lstcon_batch_ent_t tbe_batch; /* batch entry */ } u; -} lstcon_test_batch_ent_t; /*** test/batch verbose information entry, - *** for list_batch command */ +} lstcon_test_batch_ent_t; /*** test/batch verbose information entry, + *** for list_batch command */ typedef struct { - struct list_head rpe_link; /* link chain */ - lnet_process_id_t rpe_peer; /* peer's id */ - struct timeval rpe_stamp; /* time stamp of RPC */ - int rpe_state; /* peer's state */ - int rpe_rpc_errno; /* RPC errno */ + struct list_head rpe_link; /* link chain */ + lnet_process_id_t rpe_peer; /* peer's id */ + struct timeval rpe_stamp; /* time stamp of RPC */ + int rpe_state; /* peer's state */ + int rpe_rpc_errno; /* RPC errno */ - lst_sid_t rpe_sid; /* peer's session id */ - int rpe_fwk_errno; /* framework errno */ - int rpe_priv[4]; /* private data */ - char rpe_payload[0]; /* private reply payload */ + lst_sid_t rpe_sid; /* peer's session id */ + int rpe_fwk_errno; /* framework errno */ + int rpe_priv[4]; /* private data */ + char rpe_payload[0]; /* private reply payload */ } lstcon_rpc_ent_t; typedef struct { - int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */ - int trs_rpc_errno; /* RPC errno */ - int trs_fwk_stat[8]; /* framework stat */ - int trs_fwk_errno; /* errno of the first remote error */ - void *trs_fwk_private; /* private framework stat */ + int trs_rpc_stat[4]; /* RPCs stat (0: total + 1: failed + 2: finished + 4: reserved */ + int trs_rpc_errno; /* RPC errno */ + int trs_fwk_stat[8]; /* framework stat */ + int trs_fwk_errno; /* errno of the first remote error */ + void *trs_fwk_private; /* private framework stat */ } lstcon_trans_stat_t; static inline int @@ -236,234 +244,263 @@ lstcon_statqry_stat_failure(lstcon_trans_stat_t *stat, int inc) /* create a session */ typedef struct { - int lstio_ses_key; /* IN: local key */ - int lstio_ses_timeout; /* IN: session timeout */ - int lstio_ses_force; /* IN: force create ? */ + int lstio_ses_key; /* IN: local key */ + int lstio_ses_timeout; /* IN: session timeout */ + int lstio_ses_force; /* IN: force create ? */ /** IN: session features */ - unsigned lstio_ses_feats; - lst_sid_t *lstio_ses_idp; /* OUT: session id */ - int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* IN: session name */ + unsigned lstio_ses_feats; + lst_sid_t *lstio_ses_idp; /* OUT: session id */ + int lstio_ses_nmlen; /* IN: name length */ + char *lstio_ses_namep; /* IN: session name */ } lstio_session_new_args_t; /* query current session */ typedef struct { - lst_sid_t *lstio_ses_idp; /* OUT: session id */ - int *lstio_ses_keyp; /* OUT: local key */ + lst_sid_t *lstio_ses_idp; /* OUT: session id */ + int *lstio_ses_keyp; /* OUT: local key */ /** OUT: session features */ - unsigned *lstio_ses_featp; - lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */ - int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* OUT: session name */ + unsigned *lstio_ses_featp; + lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */ + int lstio_ses_nmlen; /* IN: name length */ + char *lstio_ses_namep; /* OUT: session name */ } lstio_session_info_args_t; /* delete a session */ typedef struct { - int lstio_ses_key; /* IN: session key */ + int lstio_ses_key; /* IN: session key */ } lstio_session_end_args_t; -#define LST_OPC_SESSION 1 -#define LST_OPC_GROUP 2 -#define LST_OPC_NODES 3 +#define LST_OPC_SESSION 1 +#define LST_OPC_GROUP 2 +#define LST_OPC_NODES 3 #define LST_OPC_BATCHCLI 4 #define LST_OPC_BATCHSRV 5 typedef struct { - int lstio_dbg_key; /* IN: session key */ - int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */ - int lstio_dbg_flags; /* IN: reserved debug flags */ - int lstio_dbg_timeout; /* IN: timeout of debug */ - - int lstio_dbg_nmlen; /* IN: len of name */ - char *lstio_dbg_namep; /* IN: name of group|batch */ - int lstio_dbg_count; /* IN: # of test nodes to debug */ - lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test nodes */ - struct list_head *lstio_dbg_resultp; /* OUT: list head of result buffer */ + int lstio_dbg_key; /* IN: session key */ + int lstio_dbg_type; /* IN: debug + session|batch| + group|nodes + list */ + int lstio_dbg_flags; /* IN: reserved debug + flags */ + int lstio_dbg_timeout; /* IN: timeout of + debug */ + int lstio_dbg_nmlen; /* IN: len of name */ + char *lstio_dbg_namep; /* IN: name of + group|batch */ + int lstio_dbg_count; /* IN: # of test nodes + to debug */ + lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test + nodes */ + struct list_head *lstio_dbg_resultp; /* OUT: list head of + result buffer */ } lstio_debug_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ } lstio_group_add_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ } lstio_group_del_args_t; -#define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */ -#define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */ -#define LST_GROUP_RMND 3 /* delete nodes from the group */ - -typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_opc; /* IN: OPC */ - int lstio_grp_args; /* IN: arguments */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ - int lstio_grp_count; /* IN: # of nodes id */ - lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */ - struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */ +#define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */ +#define LST_GROUP_REFRESH 2 /* refresh inactive nodes + * in the group */ +#define LST_GROUP_RMND 3 /* delete nodes from the group */ + +typedef struct { + int lstio_grp_key; /* IN: session key */ + int lstio_grp_opc; /* IN: OPC */ + int lstio_grp_args; /* IN: arguments */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_count; /* IN: # of nodes id */ + lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */ + struct list_head *lstio_grp_resultp; /* OUT: list head of + result buffer */ } lstio_group_update_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ - int lstio_grp_count; /* IN: # of nodes */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_count; /* IN: # of nodes */ /** OUT: session features */ - unsigned *lstio_grp_featp; - lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */ - struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */ + unsigned *lstio_grp_featp; + lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */ + struct list_head *lstio_grp_resultp; /* OUT: list head of + result buffer */ } lstio_group_nodes_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_idx; /* IN: group idx */ - int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* OUT: name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_idx; /* IN: group idx */ + int lstio_grp_nmlen; /* IN: name len */ + char *lstio_grp_namep; /* OUT: name */ } lstio_group_list_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* IN: name */ - lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of group */ - - int *lstio_grp_idxp; /* IN/OUT: node index */ - int *lstio_grp_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name len */ + char *lstio_grp_namep; /* IN: name */ + lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of + group */ + int *lstio_grp_idxp; /* IN/OUT: node index */ + int *lstio_grp_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */ } lstio_group_info_args_t; -#define LST_DEFAULT_BATCH "batch" /* default batch name */ +#define LST_DEFAULT_BATCH "batch" /* default batch name */ typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ } lstio_batch_add_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ } lstio_batch_del_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_timeout; /* IN: timeout for the batch */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_timeout; /* IN: timeout for + the batch */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ + struct list_head *lstio_bat_resultp; /* OUT: list head of + result buffer */ } lstio_batch_run_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_force; /* IN: abort unfinished test RPC */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_force; /* IN: abort unfinished + test RPC */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ + struct list_head *lstio_bat_resultp; /* OUT: list head of + result buffer */ } lstio_batch_stop_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_testidx; /* IN: test index */ - int lstio_bat_client; /* IN: is test client? */ - int lstio_bat_timeout; /* IN: timeout for waiting */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_testidx; /* IN: test index */ + int lstio_bat_client; /* IN: we testing + client? */ + int lstio_bat_timeout; /* IN: timeout for + waiting */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ + struct list_head *lstio_bat_resultp; /* OUT: list head of + result buffer */ } lstio_batch_query_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_idx; /* IN: index */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_idx; /* IN: index */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ } lstio_batch_list_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: name */ - int lstio_bat_server; /* IN: query server or not */ - int lstio_bat_testidx; /* IN: test index */ - lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: name */ + int lstio_bat_server; /* IN: query server + or not */ + int lstio_bat_testidx; /* IN: test index */ + lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */ - int *lstio_bat_idxp; /* IN/OUT: index of node */ - int *lstio_bat_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */ + int *lstio_bat_idxp; /* IN/OUT: index of node */ + int *lstio_bat_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */ } lstio_batch_info_args_t; /* add stat in session */ typedef struct { - int lstio_sta_key; /* IN: session key */ - int lstio_sta_timeout; /* IN: timeout for stat request */ - int lstio_sta_nmlen; /* IN: group name length */ - char *lstio_sta_namep; /* IN: group name */ - int lstio_sta_count; /* IN: # of pid */ - lnet_process_id_t *lstio_sta_idsp; /* IN: pid */ - struct list_head *lstio_sta_resultp; /* OUT: list head of result buffer */ + int lstio_sta_key; /* IN: session key */ + int lstio_sta_timeout; /* IN: timeout for + stat request */ + int lstio_sta_nmlen; /* IN: group name + length */ + char *lstio_sta_namep; /* IN: group name */ + int lstio_sta_count; /* IN: # of pid */ + lnet_process_id_t *lstio_sta_idsp; /* IN: pid */ + struct list_head *lstio_sta_resultp; /* OUT: list head of + result buffer */ } lstio_stat_args_t; typedef enum { - LST_TEST_BULK = 1, - LST_TEST_PING = 2 + LST_TEST_BULK = 1, + LST_TEST_PING = 2 } lst_test_type_t; /* create a test in a batch */ -#define LST_MAX_CONCUR 1024 /* Max concurrency of test */ - -typedef struct { - int lstio_tes_key; /* IN: session key */ - int lstio_tes_bat_nmlen; /* IN: batch name len */ - char *lstio_tes_bat_name; /* IN: batch name */ - int lstio_tes_type; /* IN: test type */ - int lstio_tes_oneside; /* IN: one sided test */ - int lstio_tes_loop; /* IN: loop count */ - int lstio_tes_concur; /* IN: concurrency */ - - int lstio_tes_dist; /* IN: node distribution in destination groups */ - int lstio_tes_span; /* IN: node span in destination groups */ - int lstio_tes_sgrp_nmlen; /* IN: source group name length */ - char *lstio_tes_sgrp_name; /* IN: group name */ - int lstio_tes_dgrp_nmlen; /* IN: destination group name length */ - char *lstio_tes_dgrp_name; /* IN: group name */ - - int lstio_tes_param_len; /* IN: param buffer len */ - void *lstio_tes_param; /* IN: parameter for specified test: - lstio_bulk_param_t, - lstio_ping_param_t, - ... more */ - int *lstio_tes_retp; /* OUT: private returned value */ - struct list_head *lstio_tes_resultp; /* OUT: list head of result buffer */ +#define LST_MAX_CONCUR 1024 /* Max concurrency of test */ + +typedef struct { + int lstio_tes_key; /* IN: session key */ + int lstio_tes_bat_nmlen; /* IN: batch name len */ + char *lstio_tes_bat_name; /* IN: batch name */ + int lstio_tes_type; /* IN: test type */ + int lstio_tes_oneside; /* IN: one sided test */ + int lstio_tes_loop; /* IN: loop count */ + int lstio_tes_concur; /* IN: concurrency */ + + int lstio_tes_dist; /* IN: node distribution in + destination groups */ + int lstio_tes_span; /* IN: node span in + destination groups */ + int lstio_tes_sgrp_nmlen; /* IN: source group + name length */ + char *lstio_tes_sgrp_name; /* IN: group name */ + int lstio_tes_dgrp_nmlen; /* IN: destination group + name length */ + char *lstio_tes_dgrp_name; /* IN: group name */ + + int lstio_tes_param_len; /* IN: param buffer len */ + void *lstio_tes_param; /* IN: parameter for specified + test: + lstio_bulk_param_t, + lstio_ping_param_t, + ... more */ + int *lstio_tes_retp; /* OUT: private returned + value */ + struct list_head *lstio_tes_resultp; /* OUT: list head of + result buffer */ } lstio_test_args_t; typedef enum { - LST_BRW_READ = 1, - LST_BRW_WRITE = 2 + LST_BRW_READ = 1, + LST_BRW_WRITE = 2 } lst_brw_type_t; typedef enum { - LST_BRW_CHECK_NONE = 1, - LST_BRW_CHECK_SIMPLE = 2, - LST_BRW_CHECK_FULL = 3 + LST_BRW_CHECK_NONE = 1, + LST_BRW_CHECK_SIMPLE = 2, + LST_BRW_CHECK_FULL = 3 } lst_brw_flags_t; typedef struct { - int blk_opc; /* bulk operation code */ - int blk_size; /* size (bytes) */ - int blk_time; /* time of running the test*/ - int blk_flags; /* reserved flags */ + int blk_opc; /* bulk operation code */ + int blk_size; /* size (bytes) */ + int blk_time; /* time of running the test*/ + int blk_flags; /* reserved flags */ } lst_test_bulk_param_t; typedef struct { - int png_size; /* size of ping message */ - int png_time; /* time */ - int png_loop; /* loop */ - int png_flags; /* reserved flags */ + int png_size; /* size of ping message */ + int png_time; /* time */ + int png_loop; /* loop */ + int png_flags; /* reserved flags */ } lst_test_ping_param_t; typedef struct { diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index f7c7b08..4c790bd 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -42,29 +42,29 @@ #define SOCKLND_CONN_NONE (-1) #define SOCKLND_CONN_ANY 0 -#define SOCKLND_CONN_CONTROL 1 -#define SOCKLND_CONN_BULK_IN 2 -#define SOCKLND_CONN_BULK_OUT 3 -#define SOCKLND_CONN_NTYPES 4 +#define SOCKLND_CONN_CONTROL 1 +#define SOCKLND_CONN_BULK_IN 2 +#define SOCKLND_CONN_BULK_OUT 3 +#define SOCKLND_CONN_NTYPES 4 #define SOCKLND_CONN_ACK SOCKLND_CONN_BULK_IN typedef struct { - __u32 kshm_magic; /* magic number of socklnd message */ - __u32 kshm_version; /* version of socklnd message */ - lnet_nid_t kshm_src_nid; /* sender's nid */ - lnet_nid_t kshm_dst_nid; /* destination nid */ - lnet_pid_t kshm_src_pid; /* sender's pid */ - lnet_pid_t kshm_dst_pid; /* destination pid */ - __u64 kshm_src_incarnation; /* sender's incarnation */ - __u64 kshm_dst_incarnation; /* destination's incarnation */ - __u32 kshm_ctype; /* connection type */ - __u32 kshm_nips; /* # IP addrs */ - __u32 kshm_ips[0]; /* IP addrs */ + __u32 kshm_magic; /* magic number of socklnd message */ + __u32 kshm_version; /* version of socklnd message */ + lnet_nid_t kshm_src_nid; /* sender's nid */ + lnet_nid_t kshm_dst_nid; /* destination nid */ + lnet_pid_t kshm_src_pid; /* sender's pid */ + lnet_pid_t kshm_dst_pid; /* destination pid */ + __u64 kshm_src_incarnation; /* sender's incarnation */ + __u64 kshm_dst_incarnation; /* destination's incarnation */ + __u32 kshm_ctype; /* connection type */ + __u32 kshm_nips; /* # IP addrs */ + __u32 kshm_ips[0]; /* IP addrs */ } WIRE_ATTR ksock_hello_msg_t; typedef struct { - lnet_hdr_t ksnm_hdr; /* lnet hdr */ + lnet_hdr_t ksnm_hdr; /* lnet hdr */ /* * ksnm_payload is removed because of winnt compiler's limitation: @@ -75,28 +75,29 @@ typedef struct { } WIRE_ATTR ksock_lnet_msg_t; typedef struct { - __u32 ksm_type; /* type of socklnd message */ - __u32 ksm_csum; /* checksum if != 0 */ - __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ + __u32 ksm_type; /* type of socklnd message */ + __u32 ksm_csum; /* checksum if != 0 */ + __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ union { - ksock_lnet_msg_t lnetmsg; /* lnet message, it's empty if it's NOOP */ + ksock_lnet_msg_t lnetmsg;/* lnet message, it's empty if + * it's NOOP */ } WIRE_ATTR ksm_u; } WIRE_ATTR ksock_msg_t; static inline void socklnd_init_msg(ksock_msg_t *msg, int type) { - msg->ksm_csum = 0; - msg->ksm_type = type; - msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0; + msg->ksm_csum = 0; + msg->ksm_type = type; + msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0; } -#define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */ -#define KSOCK_MSG_LNET 0xc1 /* lnet msg */ +#define KSOCK_MSG_NOOP 0xC0 /* ksm_u empty */ +#define KSOCK_MSG_LNET 0xC1 /* lnet msg */ /* We need to know this number to parse hello msg from ksocklnd in * other LND (usocklnd, for example) */ -#define KSOCK_PROTO_V2 2 -#define KSOCK_PROTO_V3 3 +#define KSOCK_PROTO_V2 2 +#define KSOCK_PROTO_V3 3 #endif diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 32b9431..00a42f8 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -48,7 +48,7 @@ /** Portal reserved for LNet's own use. * \see lustre/include/lustre/lustre_idl.h for Lustre portal assignments. */ -#define LNET_RESERVED_PORTAL 0 +#define LNET_RESERVED_PORTAL 0 /** * Address of an end-point in an LNet network. @@ -68,15 +68,15 @@ typedef __u64 lnet_nid_t; typedef __u32 lnet_pid_t; /** wildcard NID that matches any end-point address */ -#define LNET_NID_ANY ((lnet_nid_t) -1) +#define LNET_NID_ANY ((lnet_nid_t) -1) /** wildcard PID that matches any lnet_pid_t */ -#define LNET_PID_ANY ((lnet_pid_t) -1) +#define LNET_PID_ANY ((lnet_pid_t) -1) #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */ #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */ #define LNET_PID_LUSTRE 12345 -#define LNET_TIME_FOREVER (-1) +#define LNET_TIME_FOREVER (-1) /* how an LNET NID encodes net:address */ /** extract the address part of an lnet_nid_t */ @@ -380,7 +380,7 @@ typedef struct { * one must start on page boundary, and all but the last must end on * page boundary. */ - void *start; + void *start; unsigned int length; /** * Specifies the maximum number of operations that can be performed @@ -392,7 +392,7 @@ typedef struct { * there is no bound on the number of operations that may be applied * to a MD. */ - int threshold; + int threshold; /** * Specifies the largest incoming request that the memory descriptor * should respond to. When the unused portion of a MD (length - @@ -400,7 +400,7 @@ typedef struct { * does not respond to further operations. This value is only used * if the LNET_MD_MAX_SIZE option is set. */ - int max_size; + int max_size; /** * Specifies the behavior of the memory descriptor. A bitwise OR * of the following values can be used: @@ -437,14 +437,14 @@ typedef struct { * region (i.e. sum of all fragment lengths) must not be less than * \a max_size. */ - unsigned int options; + unsigned int options; /** * A user-specified value that is associated with the memory * descriptor. The value does not need to be a pointer, but must fit * in the space used by a pointer. This value is recorded in events * associated with operations on this MD. */ - void *user_ptr; + void *user_ptr; /** * A handle for the event queue used to log the operations performed on * the memory region. If this argument is a NULL handle (i.e. nullified @@ -461,33 +461,33 @@ typedef struct { #define LNET_MTU (1 << LNET_MTU_BITS) /** limit on the number of fragments in discontiguous MDs */ -#define LNET_MAX_IOV 256 +#define LNET_MAX_IOV 256 /** * Options for the MD structure. See lnet_md_t::options. */ -#define LNET_MD_OP_PUT (1 << 0) +#define LNET_MD_OP_PUT (1 << 0) /** See lnet_md_t::options. */ -#define LNET_MD_OP_GET (1 << 1) +#define LNET_MD_OP_GET (1 << 1) /** See lnet_md_t::options. */ #define LNET_MD_MANAGE_REMOTE (1 << 2) -/* unused (1 << 3) */ +/* unused (1 << 3) */ /** See lnet_md_t::options. */ -#define LNET_MD_TRUNCATE (1 << 4) +#define LNET_MD_TRUNCATE (1 << 4) /** See lnet_md_t::options. */ -#define LNET_MD_ACK_DISABLE (1 << 5) +#define LNET_MD_ACK_DISABLE (1 << 5) /** See lnet_md_t::options. */ #define LNET_MD_IOVEC (1 << 6) /** See lnet_md_t::options. */ -#define LNET_MD_MAX_SIZE (1 << 7) +#define LNET_MD_MAX_SIZE (1 << 7) /** See lnet_md_t::options. */ -#define LNET_MD_KIOV (1 << 8) +#define LNET_MD_KIOV (1 << 8) /* For compatibility with Cray Portals */ -#define LNET_MD_PHYS 0 +#define LNET_MD_PHYS 0 /** Infinite threshold on MD operations. See lnet_md_t::threshold */ -#define LNET_MD_THRESH_INF (-1) +#define LNET_MD_THRESH_INF (-1) /* NB lustre portals uses struct iovec internally! */ typedef struct iovec lnet_md_iovec_t; @@ -497,15 +497,15 @@ typedef struct iovec lnet_md_iovec_t; */ typedef struct { /** Pointer to the page where the fragment resides */ - struct page *kiov_page; + struct page *kiov_page; /** Length in bytes of the fragment */ - unsigned int kiov_len; + unsigned int kiov_len; /** * Starting offset of the fragment within the page. Note that the * end of the fragment must not pass the end of the page; i.e., * kiov_len + kiov_offset <= PAGE_CACHE_SIZE. */ - unsigned int kiov_offset; + unsigned int kiov_offset; } lnet_kiov_t; /** @} lnet_md */ @@ -553,7 +553,7 @@ typedef enum { LNET_EVENT_UNLINK, } lnet_event_kind_t; -#define LNET_SEQ_BASETYPE long +#define LNET_SEQ_BASETYPE long typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t; #define LNET_SEQ_GT(a, b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0) @@ -562,23 +562,23 @@ typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t; */ typedef struct { /** The identifier (nid, pid) of the target. */ - lnet_process_id_t target; + lnet_process_id_t target; /** The identifier (nid, pid) of the initiator. */ - lnet_process_id_t initiator; + lnet_process_id_t initiator; /** * The NID of the immediate sender. If the request has been forwarded * by routers, this is the NID of the last hop; otherwise it's the * same as the initiator. */ - lnet_nid_t sender; + lnet_nid_t sender; /** Indicates the type of the event. */ - lnet_event_kind_t type; + lnet_event_kind_t type; /** The portal table index specified in the request */ - unsigned int pt_index; + unsigned int pt_index; /** A copy of the match bits specified in the request. */ - __u64 match_bits; + __u64 match_bits; /** The length (in bytes) specified in the request. */ - unsigned int rlength; + unsigned int rlength; /** * The length (in bytes) of the data that was manipulated by the * operation. For truncated operations, the manipulated length will be @@ -586,47 +586,47 @@ typedef struct { * see lnet_md_t). For all other operations, the manipulated length * will be the length of the requested operation, i.e. rlength. */ - unsigned int mlength; + unsigned int mlength; /** * The handle to the MD associated with the event. The handle may be * invalid if the MD has been unlinked. */ - lnet_handle_md_t md_handle; + lnet_handle_md_t md_handle; /** * A snapshot of the state of the MD immediately after the event has * been processed. In particular, the threshold field in md will * reflect the value of the threshold after the operation occurred. */ - lnet_md_t md; + lnet_md_t md; /** * 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT. * \see LNetPut */ - __u64 hdr_data; + __u64 hdr_data; /** * Indicates the completion status of the operation. It's 0 for * successful operations, otherwise it's an error code. */ - int status; + int status; /** * Indicates whether the MD has been unlinked. Note that: * - An event with unlinked set is the last event on the MD. * - This field is also set for an explicit LNET_EVENT_UNLINK event. * \see LNetMDUnlink */ - int unlinked; + int unlinked; /** * The displacement (in bytes) into the memory region that the * operation used. The offset can be determined by the operation for * a remote managed MD or by the local MD. * \see lnet_md_t::options */ - unsigned int offset; + unsigned int offset; /** * The sequence number for this event. Sequence numbers are unique * to each event. */ - volatile lnet_seq_t sequence; + volatile lnet_seq_t sequence; } lnet_event_t; /** -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 20:43:23 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:23 -0400 Subject: [lustre-devel] [PATCH v3 4/8] staging:lustre: move LNet NID macros to LNet layer In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-5-git-send-email-jsimmons@infradead.org> Currently several special macros LNet NID macros exist in libcfs.h and libcfs_private.h. Move those macros out to the lnet header types.h. The new lnet header nidstr.h contains LNet NID string data that can be used by user land LNet utilities and the LNet kernel drivers. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_private.h | 55 -------------- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 + drivers/staging/lustre/include/linux/lnet/lnet.h | 5 +- drivers/staging/lustre/include/linux/lnet/nidstr.h | 76 ++++++++++++++++++++ drivers/staging/lustre/include/linux/lnet/types.h | 33 +++++++++ .../lustre/lustre/include/lustre/lustre_idl.h | 1 + drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- 7 files changed, 114 insertions(+), 61 deletions(-) create mode 100644 drivers/staging/lustre/include/linux/lnet/nidstr.h diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index d8f8543..ed37d26 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -42,14 +42,10 @@ #ifndef __LIBCFS_PRIVATE_H__ #define __LIBCFS_PRIVATE_H__ -/* XXX this layering violation is for nidstrings */ -#include "../lnet/types.h" - #ifndef DEBUG_SUBSYSTEM # define DEBUG_SUBSYSTEM S_UNDEFINED #endif - /* * When this is on, LASSERT macro includes check for assignment used instead * of equality check, but doesn't have unlikely(). Turn this on from time to @@ -410,36 +406,6 @@ int cfs_percpt_atomic_summary(atomic_t **refs); */ #define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } while (0) -/* support decl needed both by kernel and liblustre */ -int libcfs_isknown_lnd(int type); -char *libcfs_lnd2modname(int type); -char *libcfs_lnd2str(int type); -int libcfs_str2lnd(const char *str); -char *libcfs_net2str(__u32 net); -char *libcfs_nid2str(lnet_nid_t nid); -__u32 libcfs_str2net(const char *str); -lnet_nid_t libcfs_str2nid(const char *str); -int libcfs_str2anynid(lnet_nid_t *nid, const char *str); -char *libcfs_id2str(lnet_process_id_t id); -void cfs_free_nidlist(struct list_head *list); -int cfs_parse_nidlist(char *str, int len, struct list_head *list); -int cfs_match_nid(lnet_nid_t nid, struct list_head *list); - -/** \addtogroup lnet_addr - * @{ */ -/* how an LNET NID encodes net:address */ -/** extract the address part of an lnet_nid_t */ -#define LNET_NIDADDR(nid) ((__u32)((nid) & 0xffffffff)) -/** extract the network part of an lnet_nid_t */ -#define LNET_NIDNET(nid) ((__u32)(((nid) >> 32)) & 0xffffffff) -/** make an lnet_nid_t from a network part and an address part */ -#define LNET_MKNID(net, addr) ((((__u64)(net))<<32)|((__u64)(addr))) -/* how net encodes type:number */ -#define LNET_NETNUM(net) ((net) & 0xffff) -#define LNET_NETTYP(net) (((net) >> 16) & 0xffff) -#define LNET_MKNET(typ, num) ((((__u32)(typ))<<16)|((__u32)(num))) -/** @} lnet_addr */ - /* max value for numeric network address */ #define MAX_NUMERIC_VALUE 0xffffffff @@ -519,25 +485,4 @@ do { \ ptr += cfs_size_round(len + 1); \ } while (0) -/** - * Lustre Network Driver types. - */ -enum { - /* Only add to these values (i.e. don't ever change or redefine them): - * network addresses depend on them... */ - QSWLND = 1, - SOCKLND = 2, - GMLND = 3, /* obsolete, keep it so that libcfs_nid2str works */ - PTLLND = 4, - O2IBLND = 5, - CIBLND = 6, - OPENIBLND = 7, - IIBLND = 8, - LOLND = 9, - RALND = 10, - VIBLND = 11, - MXLND = 12, - GNILND = 13, -}; - #endif diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index f9a7664..c224062 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -42,6 +42,7 @@ #define __LNET_LIB_LNET_H__ #include "../libcfs/libcfs.h" +#include "api.h" #include "types.h" #include "lnet.h" #include "lib-types.h" diff --git a/drivers/staging/lustre/include/linux/lnet/lnet.h b/drivers/staging/lustre/include/linux/lnet/lnet.h index 8d054a1..8124d8f 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lnet.h @@ -41,9 +41,6 @@ * User application interface file */ #include "types.h" -#include "api.h" - -#define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */ -#define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */ +#include "nidstr.h" #endif diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h new file mode 100644 index 0000000..8eaed1a --- /dev/null +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -0,0 +1,76 @@ +/* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.gnu.org/licenses/gpl-2.0.html + * + * GPL HEADER END + */ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2011, 2014, Intel Corporation. + */ +#ifndef _LNET_NIDSTRINGS_H +#define _LNET_NIDSTRINGS_H +#include "types.h" + +/** + * Lustre Network Driver types. + */ +enum { + /* Only add to these values (i.e. don't ever change or redefine them): + * network addresses depend on them... */ + QSWLND = 1, + SOCKLND = 2, + GMLND = 3, + PTLLND = 4, + O2IBLND = 5, + CIBLND = 6, + OPENIBLND = 7, + IIBLND = 8, + LOLND = 9, + RALND = 10, + VIBLND = 11, + MXLND = 12, + GNILND = 13, + GNIIPLND = 14, +}; + +struct list_head; + +#define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */ +#define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */ + +int libcfs_isknown_lnd(int type); +char *libcfs_lnd2modname(int type); +char *libcfs_lnd2str(int type); +int libcfs_str2lnd(const char *str); +char *libcfs_net2str(__u32 net); +char *libcfs_nid2str(lnet_nid_t nid); +__u32 libcfs_str2net(const char *str); +lnet_nid_t libcfs_str2nid(const char *str); +int libcfs_str2anynid(lnet_nid_t *nid, const char *str); +char *libcfs_id2str(lnet_process_id_t id); +void cfs_free_nidlist(struct list_head *list); +int cfs_parse_nidlist(char *str, int len, struct list_head *list); +int cfs_match_nid(lnet_nid_t nid, struct list_head *list); +bool cfs_nidrange_is_contiguous(struct list_head *nidlist); +void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, + char *max_nid, size_t nidstr_length); + +#endif /* _LNET_NIDSTRINGS_H */ diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 68d8139..15528a1 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -77,6 +77,39 @@ typedef __u32 lnet_pid_t; #define LNET_TIME_FOREVER (-1) +/* how an LNET NID encodes net:address */ +/** extract the address part of an lnet_nid_t */ + +static inline __u32 LNET_NIDADDR(lnet_nid_t nid) +{ + return nid & 0xffffffff; +} + +static inline __u32 LNET_NIDNET(lnet_nid_t nid) +{ + return (nid >> 32) & 0xffffffff; +} + +static inline lnet_nid_t LNET_MKNID(__u32 net, __u32 addr) +{ + return (((__u64)net) << 32) | addr; +} + +static inline __u32 LNET_NETNUM(__u32 net) +{ + return net & 0xffff; +} + +static inline __u32 LNET_NETTYP(__u32 net) +{ + return (net >> 16) & 0xffff; +} + +static inline __u32 LNET_MKNET(__u32 type, __u32 num) +{ + return (type << 16) | num; +} + /** * Objects maintained by the LNet are accessed through handles. Handle types * have names of the form lnet_handle_xx_t, where xx is one of the two letter diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 305ecbe..4d72d6e 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -92,6 +92,7 @@ #define _LUSTRE_IDL_H_ #include "../../../include/linux/libcfs/libcfs.h" +#include "../../../include/linux/lnet/types.h" /* Defn's shared with user-space. */ #include "lustre_user.h" diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 998dcd9..77a7de9 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -56,8 +56,8 @@ */ #include "../../include/linux/libcfs/libcfs.h" -// #include -#include "../../include/linux/lnet/lnet.h" +#include "../../include/linux/lnet/nidstr.h" +#include "../../include/linux/lnet/api.h" #include "lustre/lustre_idl.h" #include "lustre_ha.h" #include "lustre_sec.h" -- 1.7.1 From jsimmons at infradead.org Wed Jun 3 20:43:22 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 16:43:22 -0400 Subject: [lustre-devel] [PATCH v3 3/8] staging:lustre: delete no longer used LNet headers In-Reply-To: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433364207-14307-4-git-send-email-jsimmons@infradead.org> Remove the linux specific headers for LNet since they are mostly empty. Also api-support.h and lnet-sysctl.h is not needed by anyone. Lastly we delete ptllnd.h and ptllnd_wire.h which were used by Cray hardware that no longer exist. With the deletion of the headers some conditionals and wrappers that no longer exist are handled directly in the source code. Alongside that some user land router code is also removed. Signed-off-by: James Simmons --- .../lustre/include/linux/lnet/api-support.h | 44 ------ .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 - .../staging/lustre/include/linux/lnet/lib-types.h | 2 - .../lustre/include/linux/lnet/linux/api-support.h | 42 ------ .../lustre/include/linux/lnet/linux/lib-lnet.h | 71 ---------- .../lustre/include/linux/lnet/linux/lib-types.h | 45 ------ .../staging/lustre/include/linux/lnet/linux/lnet.h | 56 -------- .../lustre/include/linux/lnet/lnet-sysctl.h | 49 ------- drivers/staging/lustre/include/linux/lnet/lnet.h | 2 - drivers/staging/lustre/include/linux/lnet/ptllnd.h | 93 ------------- .../lustre/include/linux/lnet/ptllnd_wire.h | 119 ---------------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 1 - .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 1 - .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 4 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 2 - drivers/staging/lustre/lnet/lnet/router.c | 145 -------------------- 17 files changed, 3 insertions(+), 677 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/lnet/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-types.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h diff --git a/drivers/staging/lustre/include/linux/lnet/api-support.h b/drivers/staging/lustre/include/linux/lnet/api-support.h deleted file mode 100644 index 8f7fa28..0000000 --- a/drivers/staging/lustre/include/linux/lnet/api-support.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_API_SUPPORT_H__ -#define __LNET_API_SUPPORT_H__ - -#include "linux/api-support.h" - -#include "../libcfs/libcfs.h" -#include "types.h" -#include "lnet.h" - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index ac3be94..f9a7664 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -41,7 +41,6 @@ #ifndef __LNET_LIB_LNET_H__ #define __LNET_LIB_LNET_H__ -#include "linux/lib-lnet.h" #include "../libcfs/libcfs.h" #include "types.h" #include "lnet.h" @@ -655,7 +654,6 @@ int lnet_sock_connect(struct socket **sockp, int *fatal, __u32 peer_ip, int peer_port); void libcfs_sock_release(struct socket *sock); -void lnet_get_tunables(void); int lnet_peers_start_down(void); int lnet_peer_buffer_credits(lnet_ni_t *ni); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 41827a0..4177da2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -42,8 +42,6 @@ #ifndef __LNET_LIB_TYPES_H__ #define __LNET_LIB_TYPES_H__ -#include "linux/lib-types.h" - #include "../libcfs/libcfs.h" #include #include "types.h" diff --git a/drivers/staging/lustre/include/linux/lnet/linux/api-support.h b/drivers/staging/lustre/include/linux/lnet/linux/api-support.h deleted file mode 100644 index e237ad6..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/api-support.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LINUX_API_SUPPORT_H__ -#define __LINUX_API_SUPPORT_H__ - -#ifndef __LNET_API_SUPPORT_H__ -#error Do not #include this file directly. #include instead -#endif - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h deleted file mode 100644 index 0f8f04d..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_LINUX_LIB_LNET_H__ -#define __LNET_LINUX_LIB_LNET_H__ - -#ifndef __LNET_LIB_LNET_H__ -#error Do not #include this file directly. #include instead -#endif - -# include -# include -# include -#include "../../libcfs/libcfs.h" - -static inline __u64 -lnet_page2phys(struct page *p) -{ - /* compiler optimizer will elide unused branches */ - - switch (sizeof(typeof(page_to_phys(p)))) { - case 4: - /* page_to_phys returns a 32 bit physical address. This must - * be a 32 bit machine with <= 4G memory and we must ensure we - * don't sign extend when converting to 64 bits. */ - return (unsigned long)page_to_phys(p); - - case 8: - /* page_to_phys returns a 64 bit physical address :) */ - return page_to_phys(p); - - default: - LBUG(); - return 0; - } -} - -#define LNET_ROUTER - -#endif /* __LNET_LINUX_LIB_LNET_H__ */ diff --git a/drivers/staging/lustre/include/linux/lnet/linux/lib-types.h b/drivers/staging/lustre/include/linux/lnet/linux/lib-types.h deleted file mode 100644 index 669e8c0..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/lib-types.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_LINUX_LIB_TYPES_H__ -#define __LNET_LINUX_LIB_TYPES_H__ - -#ifndef __LNET_LIB_TYPES_H__ -#error Do not #include this file directly. #include instead -#endif - -# include -# include - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/linux/lnet.h b/drivers/staging/lustre/include/linux/lnet/linux/lnet.h deleted file mode 100644 index 1e888f1..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/lnet.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2011, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_LINUX_LNET_H__ -#define __LNET_LINUX_LNET_H__ - -#ifndef __LNET_H__ -#error Do not #include this file directly. #include instead -#endif - -/* - * lnet.h - * - * User application interface file - */ - -#include -#include - -#define cfs_tcp_sendpage(sk, page, offset, size, flags) \ - tcp_sendpage(sk, page, offset, size, flags) - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h b/drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h deleted file mode 100644 index 2dee1b9..0000000 --- a/drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_SYSCTL_H__ -#define __LNET_SYSCTL_H__ - -#if defined(CONFIG_SYSCTL) - -#define CTL_KRANAL 201 -#define CTL_O2IBLND 205 -#define CTL_PTLLND 206 -#define CTL_QSWNAL 207 -#define CTL_SOCKLND 208 -#define CTL_GNILND 210 - -#endif - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/lnet.h b/drivers/staging/lustre/include/linux/lnet/lnet.h index 75c0ab9..8d054a1 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lnet.h @@ -40,8 +40,6 @@ * * User application interface file */ -#include "linux/lnet.h" - #include "types.h" #include "api.h" diff --git a/drivers/staging/lustre/include/linux/lnet/ptllnd.h b/drivers/staging/lustre/include/linux/lnet/ptllnd.h deleted file mode 100644 index c91d653..0000000 --- a/drivers/staging/lustre/include/linux/lnet/ptllnd.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lnet/include/lnet/ptllnd.h - * - * Author: PJ Kirner - */ - -/* - * The PTLLND was designed to support Portals with - * Lustre and non-lustre UNLINK semantics. - * However for now the two targets are Cray Portals - * on the XT3 and Lustre Portals (for testing) both - * have Lustre UNLINK semantics, so this is defined - * by default. - */ -#define LUSTRE_PORTALS_UNLINK_SEMANTICS - -#ifdef _USING_LUSTRE_PORTALS_ - -/* NIDs are 64-bits on Lustre Portals */ -#define FMT_NID "%llu" -#define FMT_PID "%d" - -/* When using Lustre Portals Lustre completion semantics are imlicit*/ -#define PTL_MD_LUSTRE_COMPLETION_SEMANTICS 0 - -#else /* _USING_CRAY_PORTALS_ */ - -/* NIDs are integers on Cray Portals */ -#define FMT_NID "%u" -#define FMT_PID "%d" - -/* When using Cray Portals this is defined in the Cray Portals Header*/ -/*#define PTL_MD_LUSTRE_COMPLETION_SEMANTICS */ - -/* Can compare handles directly on Cray Portals */ -#define PtlHandleIsEqual(a, b) ((a) == (b)) - -/* Different error types on Cray Portals*/ -#define ptl_err_t ptl_ni_fail_t - -/* - * The Cray Portals has no maximum number of IOVs. The - * maximum is limited only by memory and size of the - * int parameters (2^31-1). - * Lustre only really require that the underyling - * implementation to support at least LNET_MAX_IOV, - * so for Cray portals we can safely just use that - * value here. - * - */ -#define PTL_MD_MAX_IOV LNET_MAX_IOV - -#endif - -#define FMT_PTLID "ptlid:"FMT_PID"-"FMT_NID - -/* Align incoming small request messages to an 8 byte boundary if this is - * supported to avoid alignment issues on some architectures */ -#ifndef PTL_MD_LOCAL_ALIGN8 -# define PTL_MD_LOCAL_ALIGN8 0 -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h b/drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h deleted file mode 100644 index 808f37b..0000000 --- a/drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lnet/include/lnet/ptllnd_wire.h - * - * Author: PJ Kirner - */ - -/* Minimum buffer size that any peer will post to receive ptllnd messages */ -#define PTLLND_MIN_BUFFER_SIZE 256 - -/************************************************************************ - * Tunable defaults that {u,k}lnds/ptllnd should have in common. - */ - -#define PTLLND_PORTAL 9 /* The same portal PTLPRC used when talking to cray portals */ -#define PTLLND_PID 9 /* The Portals PID */ -#define PTLLND_PEERCREDITS 8 /* concurrent sends to 1 peer */ - -/* Default buffer size for kernel ptllnds (guaranteed eager) */ -#define PTLLND_MAX_KLND_MSG_SIZE 512 - -/* Default buffer size for catamount ptllnds (not guaranteed eager) - large - * enough to avoid RDMA for anything sent while control is not in liblustre */ -#define PTLLND_MAX_ULND_MSG_SIZE 512 - -/************************************************************************ - * Portals LND Wire message format. - * These are sent in sender's byte order (i.e. receiver flips). - */ - -#define PTL_RESERVED_MATCHBITS 0x100 /* below this value is reserved - * above is for bulk data transfer */ -#define LNET_MSG_MATCHBITS 0 /* the value for the message channel */ - -typedef struct { - lnet_hdr_t kptlim_hdr; /* portals header */ - char kptlim_payload[0]; /* piggy-backed payload */ -} WIRE_ATTR kptl_immediate_msg_t; - -typedef struct { - lnet_hdr_t kptlrm_hdr; /* portals header */ - __u64 kptlrm_matchbits; /* matchbits */ -} WIRE_ATTR kptl_rdma_msg_t; - -typedef struct { - __u64 kptlhm_matchbits; /* matchbits */ - __u32 kptlhm_max_msg_size; /* max message size */ -} WIRE_ATTR kptl_hello_msg_t; - -typedef struct { - /* First 2 fields fixed FOR ALL TIME */ - __u32 ptlm_magic; /* I'm a Portals LND message */ - __u16 ptlm_version; /* this is my version number */ - __u8 ptlm_type; /* the message type */ - __u8 ptlm_credits; /* returned credits */ - __u32 ptlm_nob; /* # bytes in whole message */ - __u32 ptlm_cksum; /* checksum (0 == no checksum) */ - __u64 ptlm_srcnid; /* sender's NID */ - __u64 ptlm_srcstamp; /* sender's incarnation */ - __u64 ptlm_dstnid; /* destination's NID */ - __u64 ptlm_dststamp; /* destination's incarnation */ - __u32 ptlm_srcpid; /* sender's PID */ - __u32 ptlm_dstpid; /* destination's PID */ - - union { - kptl_immediate_msg_t immediate; - kptl_rdma_msg_t rdma; - kptl_hello_msg_t hello; - } WIRE_ATTR ptlm_u; - -} kptl_msg_t; - -/* kptl_msg_t::ptlm_credits is only a __u8 */ -#define PTLLND_MSG_MAX_CREDITS ((typeof(((kptl_msg_t *)0)->ptlm_credits)) - 1) - -#define PTLLND_MSG_MAGIC LNET_PROTO_PTL_MAGIC -#define PTLLND_MSG_VERSION 0x04 - -#define PTLLND_RDMA_OK 0x00 -#define PTLLND_RDMA_FAIL 0x01 - -#define PTLLND_MSG_TYPE_INVALID 0x00 -#define PTLLND_MSG_TYPE_PUT 0x01 -#define PTLLND_MSG_TYPE_GET 0x02 -#define PTLLND_MSG_TYPE_IMMEDIATE 0x03 /* No bulk data xfer*/ -#define PTLLND_MSG_TYPE_NOOP 0x04 -#define PTLLND_MSG_TYPE_HELLO 0x05 -#define PTLLND_MSG_TYPE_NAK 0x06 diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 060b739..2a26b7b 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1176,7 +1176,7 @@ void kiblnd_map_rx_descs(kib_conn_t *conn) CDEBUG(D_NET, "rx %d: %p %#llx(%#llx)\n", i, rx->rx_msg, rx->rx_msgaddr, - lnet_page2phys(pg) + pg_off); + (__u64)(page_to_phys(pg) + pg_off)); pg_off += IBLND_MSG_SIZE; LASSERT(pg_off <= PAGE_SIZE); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 7f52c69..f5d1d9f 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -65,7 +65,6 @@ #include "../../../include/linux/libcfs/libcfs.h" #include "../../../include/linux/lnet/lnet.h" #include "../../../include/linux/lnet/lib-lnet.h" -#include "../../../include/linux/lnet/lnet-sysctl.h" #include #include diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 06531c1..53275f9 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -34,7 +34,6 @@ #include "../../../include/linux/lnet/lnet.h" #include "../../../include/linux/lnet/lib-lnet.h" #include "../../../include/linux/lnet/socklnd.h" -#include "../../../include/linux/lnet/lnet-sysctl.h" #define SOCKNAL_PEER_HASH_SIZE 101 /* # peer lists */ #define SOCKNAL_RESCHED 100 /* # scheduler loops before reschedule */ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index 34c6a72..e4f9091 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -146,8 +146,8 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) rc = sk->sk_prot->sendpage(sk, page, offset, fragsize, msgflg); } else { - rc = cfs_tcp_sendpage(sk, page, offset, fragsize, - msgflg); + rc = tcp_sendpage(sk, page, offset, fragsize, + msgflg); } } else { #if SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_RISK_KMAP_DEADLOCK diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 9fc3bf6..a2d0d10 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1218,8 +1218,6 @@ LNetNIInit(lnet_pid_t requested_pid) goto out; } - lnet_get_tunables(); - if (requested_pid == LNET_PID_ANY) { /* Don't instantiate LNET just for me */ rc = -ENETDOWN; diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 96886a2..4fbae5e 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -24,8 +24,6 @@ #define DEBUG_SUBSYSTEM S_LNET #include "../../include/linux/lnet/lib-lnet.h" -#if defined(LNET_ROUTER) - #define LNET_NRB_TINY_MIN 512 /* min value for each CPT */ #define LNET_NRB_TINY (LNET_NRB_TINY_MIN * 4) #define LNET_NRB_SMALL_MIN 4096 /* min value for each CPT */ @@ -70,15 +68,6 @@ lnet_peer_buffer_credits(lnet_ni_t *ni) /* forward ref's */ static int lnet_router_checker(void *); -#else - -int -lnet_peer_buffer_credits(lnet_ni_t *ni) -{ - return 0; -} - -#endif static int check_routers_before_use; module_param(check_routers_before_use, int, 0444); @@ -1163,9 +1152,6 @@ lnet_prune_rc_data(int wait_unlink) lnet_net_unlock(LNET_LOCK_EX); } - -#if defined(LNET_ROUTER) - static int lnet_router_checker(void *arg) { @@ -1573,134 +1559,3 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) return 0; } EXPORT_SYMBOL(lnet_notify); - -void -lnet_get_tunables(void) -{ -} - -#else - -int -lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) -{ - return -EOPNOTSUPP; -} - -void -lnet_router_checker(void) -{ - static time_t last; - static int running; - - time_t now = get_seconds(); - int interval = now - last; - int rc; - __u64 version; - lnet_peer_t *rtr; - - /* It's no use to call me again within a sec - all intervals and - * timeouts are measured in seconds */ - if (last != 0 && interval < 2) - return; - - if (last != 0 && - interval > max(live_router_check_interval, - dead_router_check_interval)) - CNETERR("Checker(%d/%d) not called for %d seconds\n", - live_router_check_interval, dead_router_check_interval, - interval); - - LASSERT(LNET_CPT_NUMBER == 1); - - lnet_net_lock(0); - LASSERT(!running); /* recursion check */ - running = 1; - lnet_net_unlock(0); - - last = now; - - if (the_lnet.ln_rc_state == LNET_RC_STATE_STOPPING) - lnet_prune_rc_data(0); /* unlink all rcd and nowait */ - - /* consume all pending events */ - while (1) { - int i; - lnet_event_t ev; - - /* NB ln_rc_eqh must be the 1st in 'eventqs' otherwise the - * recursion breaker in LNetEQPoll would fail */ - rc = LNetEQPoll(&the_lnet.ln_rc_eqh, 1, 0, &ev, &i); - if (rc == 0) /* no event pending */ - break; - - /* NB a lost SENT prevents me from pinging a router again */ - if (rc == -EOVERFLOW) { - CERROR("Dropped an event!!!\n"); - abort(); - } - - LASSERT(rc == 1); - - lnet_router_checker_event(&ev); - } - - if (the_lnet.ln_rc_state == LNET_RC_STATE_STOPPING) { - lnet_prune_rc_data(1); /* release rcd */ - the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN; - running = 0; - return; - } - - LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); - - lnet_net_lock(0); - - version = the_lnet.ln_routers_version; - list_for_each_entry(rtr, &the_lnet.ln_routers, lp_rtr_list) { - lnet_ping_router_locked(rtr); - LASSERT(version == the_lnet.ln_routers_version); - } - - lnet_net_unlock(0); - - running = 0; /* lock only needed for the recursion check */ -} - -/* NB lnet_peers_start_down depends on me, - * so must be called before any peer creation */ -void -lnet_get_tunables(void) -{ - char *s; - - s = getenv("LNET_ROUTER_PING_TIMEOUT"); - if (s != NULL) - router_ping_timeout = atoi(s); - - s = getenv("LNET_LIVE_ROUTER_CHECK_INTERVAL"); - if (s != NULL) - live_router_check_interval = atoi(s); - - s = getenv("LNET_DEAD_ROUTER_CHECK_INTERVAL"); - if (s != NULL) - dead_router_check_interval = atoi(s); - - /* This replaces old lnd_notify mechanism */ - check_routers_before_use = 1; - if (dead_router_check_interval <= 0) - dead_router_check_interval = 30; -} - -void -lnet_rtrpools_free(void) -{ -} - -int -lnet_rtrpools_alloc(int im_a_arouter) -{ - return 0; -} - -#endif -- 1.7.1 From bass6 at llnl.gov Wed Jun 3 20:57:25 2015 From: bass6 at llnl.gov (Ned Bass) Date: Wed, 3 Jun 2015 13:57:25 -0700 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <556F6341.3070507@cray.com> References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> <556F6341.3070507@cray.com> Message-ID: <20150603205725.GH10066@llnl.gov> On Wed, Jun 03, 2015 at 03:27:45PM -0500, Patrick Farrell wrote: > You say you just install the library and not the utils, but do you > specifically build without the utils? Is there some existing config > option for that? (Hoping to save myself some grepping...) > Otherwise, I'll have to add in that option. There's no such config option, I just manually perform the build steps after configure. Something like this: ./configure --disable-server --disable-readline cd lustre/utils make CC=mpicc liblustreapi.a <$BQQ_BIN_DIR>/gcc -shared -Wl,-soname,liblustreapi.so.0 -o liblustreapi.so.0 liblustreapi*.o l_ioctl.o kernel_user_comm.o Kind of a hack, but we don't update it often so I haven't bothered to add build system support. Ned From simmonsja at ornl.gov Wed Jun 3 21:02:46 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 3 Jun 2015 21:02:46 +0000 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> References: <556F5BA7.1020301@llnl.gov> <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> Message-ID: <2fdebaed04444cb78c1888dab211ca39@EXCHCS32.ornl.gov> >Right, we need OAuth2, which is what Google calls Google OpenID Connect. It looks this has been addressed as of Gerrit 2.10.2. > >https://code.google.com/p/gerrit/issues/detail?id=2677 Just after we migrated so go through the hassle of going back :-( On Jun 3, 2015, at 13:03 , Colin Faber > wrote: Hi Chris, >From what I can tell, the OAuth2 and OpenID 2.0 combo does work for google account authentication against gerrit: http://gerrit.cloudlinux.com:8080/login/%23%2Fq%2Fstatus%3Aopen -cf On Wed, Jun 3, 2015 at 1:55 PM, Christopher J. Morrone > wrote: I think you might have that backwards. Google has _stopped_ supporting OpenID 2.0. To the best of my knowledge no version of gerrit yet supports Google's new OpenID Connect system. Chris On 06/03/2015 12:52 PM, Colin Faber wrote: Hi, This is probably more a question for the folks at Intel.. Is there an ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such changes would allow for google logins to function correctly. -cf _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From simmonsja at ornl.gov Wed Jun 3 21:07:11 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 3 Jun 2015 21:07:11 +0000 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <556F6341.3070507@cray.com> References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> <556F6341.3070507@cray.com> Message-ID: <116ba3cddacd422ca0f9b597c691f5df@EXCHCS32.ornl.gov> >You say you just install the library and not the utils, but do you >specifically build without the utils? Is there some existing config >option for that? (Hoping to save myself some grepping...) Otherwise, >I'll have to add in that option. > >It also seems that readline-devel isn't available for the Intel Xeon Phi >chips (or at least Cray doesn't have it in our build setup). This is just papering over the real problem. The utilites should be using getopt() instead. The only thing Parse does that is non standard is an interactive command line. The only place I have ever used that is for lnet selftest. Does lfs really need an interactive command line? I think not. - Patrick On 06/03/2015 01:57 PM, Ned Bass wrote: > Hi Patrick, > > LLNL builds a stand-alone liblustreapi library for our BG/Q compute > nodes, and readline isn't available there. Now, since we just install > the library and not the utils we don't actually need readline. Perhaps > rather than making the readline configurue check stricly mandatory, we > could add a --disable-utils option which, if specified, would make > readline optional. > > Thanks, > Ned > > On Wed, Jun 03, 2015 at 01:32:05PM -0500, Patrick Farrell wrote: >> Good afternoon, >> >> Cray has recently discovered that 'lfs getstripe' crashes with a >> null pointer if it is not built with libreadline (Found in >> 'readline-devel'). >> >> When built without libreadline, Lustre uses its own implementation >> of the readline components it needs. (Look for "HAVE_LIBREADLINE" >> in libcfs/libcfs/util/parser.c) This is the source of the null >> pointer. >> >> I think libreadline should be available on every platform we wish to >> build Lustre on, so I'd rather not fix the broken internal version >> of it. Given that, is there any objection to adding an explicit >> BuildRequires to the spec, making it mandatory in the config >> process, and removing all traces of Lustre's internal readline >> implementation? If not, I'll open a Jira ticket to do this. >> >> - Patrick >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From morrone2 at llnl.gov Wed Jun 3 21:24:08 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 03 Jun 2015 14:24:08 -0700 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> References: <556F5BA7.1020301@llnl.gov> <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> Message-ID: <556F7078.1020407@llnl.gov> Is it perhaps that gerrit doesn't entirely support it natively, but there is an external gerrit plugin (gerrit-oauth-provier) that makes it work with gerrit 2.10.3.1 or 2.11? Their documentation is none too clear. Chris On 06/03/2015 01:14 PM, Read, Robert wrote: > Right, we need OAuth2, which is what Google calls Google OpenID Connect. It looks this has been addressed as of Gerrit 2.10.2. > > https://code.google.com/p/gerrit/issues/detail?id=2677 > > > robert > > > On Jun 3, 2015, at 13:03 , Colin Faber > wrote: > > Hi Chris, > >>From what I can tell, the OAuth2 and OpenID 2.0 combo does work for google account authentication against gerrit: > > http://gerrit.cloudlinux.com:8080/login/%23%2Fq%2Fstatus%3Aopen > > > -cf > > > > On Wed, Jun 3, 2015 at 1:55 PM, Christopher J. Morrone > wrote: > I think you might have that backwards. Google has _stopped_ supporting OpenID 2.0. To the best of my knowledge no version of gerrit yet supports Google's new OpenID Connect system. > > Chris > > > On 06/03/2015 12:52 PM, Colin Faber wrote: > Hi, > > This is probably more a question for the folks at Intel.. Is there an > ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such > changes would allow for google logins to function correctly. > > -cf > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > From cfaber at gmail.com Wed Jun 3 21:25:03 2015 From: cfaber at gmail.com (Colin Faber) Date: Wed, 3 Jun 2015 15:25:03 -0600 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: <556F7078.1020407@llnl.gov> References: <556F5BA7.1020301@llnl.gov> <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> <556F7078.1020407@llnl.gov> Message-ID: I believe that's the case from what I understand. On Wed, Jun 3, 2015 at 3:24 PM, Christopher J. Morrone wrote: > Is it perhaps that gerrit doesn't entirely support it natively, but there > is an external gerrit plugin (gerrit-oauth-provier) that makes it work with > gerrit 2.10.3.1 or 2.11? Their documentation is none too clear. > > Chris > > > On 06/03/2015 01:14 PM, Read, Robert wrote: > >> Right, we need OAuth2, which is what Google calls Google OpenID Connect. >> It looks this has been addressed as of Gerrit 2.10.2. >> >> https://code.google.com/p/gerrit/issues/detail?id=2677 >> >> >> robert >> >> >> On Jun 3, 2015, at 13:03 , Colin Faber > colin.faber at seagate.com>> wrote: >> >> Hi Chris, >> >> From what I can tell, the OAuth2 and OpenID 2.0 combo does work for >>> google account authentication against gerrit: >>> >> >> http://gerrit.cloudlinux.com:8080/login/%23%2Fq%2Fstatus%3Aopen >> >> >> -cf >> >> >> >> On Wed, Jun 3, 2015 at 1:55 PM, Christopher J. Morrone > > wrote: >> I think you might have that backwards. Google has _stopped_ supporting >> OpenID 2.0. To the best of my knowledge no version of gerrit yet supports >> Google's new OpenID Connect system. >> >> Chris >> >> >> On 06/03/2015 12:52 PM, Colin Faber wrote: >> Hi, >> >> This is probably more a question for the folks at Intel.. Is there an >> ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such >> changes would allow for google logins to function correctly. >> >> -cf >> >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> >> >> > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.suykerbuyk at seagate.com Wed Jun 3 20:27:40 2015 From: john.suykerbuyk at seagate.com (John Suykerbuyk) Date: Wed, 3 Jun 2015 14:27:40 -0600 Subject: [lustre-devel] An updated quick start guide for a virtual Lustre clustre - call for input Message-ID: Hello, I’m a fairly new hire with Seagate’s Cloud Services group supporting and contributing to Lustre. Being relatively unfamiliar with Lustre, I was given the opportunity to write a quick-start guide that new developers such as myself could follow. I’m soliciting any input as to what others might want to be included before submitting my final draft. At LUG 2015, Brian Andrus had an excellent presentation that I’m basing my document upon and extending ( http://cdn.opensfs.org/wp-content/uploads/2015/04/Lustre-101_Andrus.pdf). My intent is to enable new developers to quickly get a virtual Lustre cluster up and running with very little knowledge of Lustre, KVM or even specifics of which repositories and packages to pull from to get things to “just work”. At the moment, my write up is about 80% complete, and I have a collection of very simple BASH scripts that bootstraps Centos 6.6 VM’s entirely from a local kickstart file with no local installation media required (everything is pulled from mirrors.centos.org). I am also setting up YUM in the VM’s to prioritise the repos at https://downloads.hpdd.intel.com/public/lustre and https://downloads.hpdd.intel.com/public/e2fsprogs ahead of anything else along with another very simple script that does the the actual install and configuration. I chose to document much of the menial steps in scripts as it serves to both document what pages of text would attempt to explain and it gives the option to “just use it”. Before wrapping this up and presenting the final draft, I am turning to the community for any input on things that should be included. Thank you! John Suykerbuyk -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Wed Jun 3 21:35:29 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 03 Jun 2015 14:35:29 -0700 Subject: [lustre-devel] An updated quick start guide for a virtual Lustre clustre - call for input In-Reply-To: References: Message-ID: <556F7321.4000105@llnl.gov> Hi John, Welcome aboard! We are happy to have you. I don't have to much to say, except that we probably won't have much useful input for you until we can see the draft. When you get the draft up on wiki.lustre.org, let us know again and I am sure that some of us will have some feedback for you. Thanks, Chris On 06/03/2015 01:27 PM, John Suykerbuyk wrote: > Hello, > > > I’m a fairly new hire with Seagate’s Cloud Services group supporting and > contributing to Lustre. Being relatively unfamiliar with Lustre, I was > given the opportunity to write a quick-start guide that new developers > such as myself could follow. > > I’m soliciting any input as to what others might want to be included > before submitting my final draft. > > At LUG 2015, Brian Andrus had an excellent presentation that I’m basing > my document upon and extending > (http://cdn.opensfs.org/wp-content/uploads/2015/04/Lustre-101_Andrus.pdf). > > > My intent is to enable new developers to quickly get a virtual Lustre > cluster up and running with very little knowledge of Lustre, KVM or even > specifics of which repositories and packages to pull from to get things > to “just work”. > > > At the moment, my write up is about 80% complete, and I have a > collection of very simple BASH scripts that bootstraps Centos 6.6 VM’s > entirely from a local kickstart file with no local installation media > required (everything is pulled from mirrors.centos.org > ). I am also setting up YUM in the VM’s to > prioritise the repos at > https://downloads.hpdd.intel.com/public/lustreand > https://downloads.hpdd.intel.com/public/e2fsprogsahead of anything else > along with another very simple script that does the the actual install > and configuration. > > > I chose to document much of the menial steps in scripts as it serves to > both document what pages of text would attempt to explain and it gives > the option to “just use it”. > > > Before wrapping this up and presenting the final draft, I am turning to > the community for any input on things that should be included. > > > Thank you! > > John Suykerbuyk > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From john.suykerbuyk at seagate.com Wed Jun 3 21:52:13 2015 From: john.suykerbuyk at seagate.com (John Suykerbuyk) Date: Wed, 3 Jun 2015 15:52:13 -0600 Subject: [lustre-devel] An updated quick start guide for a virtual Lustre clustre - call for input In-Reply-To: <556F7321.4000105@llnl.gov> References: <556F7321.4000105@llnl.gov> Message-ID: Thanks Chris, Is there a particular section or place you'd like me to post my Lustre Quick Start guide? Looking around on wiki.lustre.org, the best fit seems to be to add a "Guides" subsection to the developer page and then add my document to that. - John "S" On Wed, Jun 3, 2015 at 3:35 PM, Christopher J. Morrone wrote: > Hi John, > > Welcome aboard! We are happy to have you. > > I don't have to much to say, except that we probably won't have much > useful input for you until we can see the draft. When you get the draft up > on wiki.lustre.org, let us know again and I am sure that some of us will > have some feedback for you. > > Thanks, > Chris > > On 06/03/2015 01:27 PM, John Suykerbuyk wrote: > >> Hello, >> >> >> I’m a fairly new hire with Seagate’s Cloud Services group supporting and >> contributing to Lustre. Being relatively unfamiliar with Lustre, I was >> given the opportunity to write a quick-start guide that new developers >> such as myself could follow. >> >> I’m soliciting any input as to what others might want to be included >> before submitting my final draft. >> >> At LUG 2015, Brian Andrus had an excellent presentation that I’m basing >> my document upon and extending >> (http://cdn.opensfs.org/wp-content/uploads/2015/04/Lustre-101_Andrus.pdf >> ). >> >> >> My intent is to enable new developers to quickly get a virtual Lustre >> cluster up and running with very little knowledge of Lustre, KVM or even >> specifics of which repositories and packages to pull from to get things >> to “just work”. >> >> >> At the moment, my write up is about 80% complete, and I have a >> collection of very simple BASH scripts that bootstraps Centos 6.6 VM’s >> entirely from a local kickstart file with no local installation media >> required (everything is pulled from mirrors.centos.org >> ). I am also setting up YUM in the VM’s to >> prioritise the repos at >> https://downloads.hpdd.intel.com/public/lustreand >> https://downloads.hpdd.intel.com/public/e2fsprogsahead of anything else >> along with another very simple script that does the the actual install >> and configuration. >> >> >> I chose to document much of the menial steps in scripts as it serves to >> both document what pages of text would attempt to explain and it gives >> the option to “just use it”. >> >> >> Before wrapping this up and presenting the final draft, I am turning to >> the community for any input on things that should be included. >> >> >> Thank you! >> >> John Suykerbuyk >> >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> >> > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Wed Jun 3 21:57:25 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 03 Jun 2015 14:57:25 -0700 Subject: [lustre-devel] An updated quick start guide for a virtual Lustre clustre - call for input In-Reply-To: References: <556F7321.4000105@llnl.gov> Message-ID: <556F7845.3010703@llnl.gov> Hi John, Don't worry about how we link to it at this stage. Just pick a descriptive, unique, short title (which will also function as the URL, so choose wisely) and make the page. But even there, don't sweat it too much, because we can always rename the page later if we come up with a better title. We can worry about from where we should link to your page when the page was reached a point that you think it is ready for general consumption of its target audience. No doubt there will be links to it from more than one other page. Chris On 06/03/2015 02:52 PM, John Suykerbuyk wrote: > Thanks Chris, > > Is there a particular section or place you'd like me to post my Lustre > Quick Start guide? Looking around on wiki.lustre.org > , the best fit seems to be to add a "Guides" > subsection to the developer page and then add my document to that. > > - John "S" > > On Wed, Jun 3, 2015 at 3:35 PM, Christopher J. Morrone > > wrote: > > Hi John, > > Welcome aboard! We are happy to have you. > > I don't have to much to say, except that we probably won't have much > useful input for you until we can see the draft. When you get the > draft up on wiki.lustre.org , let us know > again and I am sure that some of us will have some feedback for you. > > Thanks, > Chris > > On 06/03/2015 01:27 PM, John Suykerbuyk wrote: > > Hello, > > > I’m a fairly new hire with Seagate’s Cloud Services group > supporting and > contributing to Lustre. Being relatively unfamiliar with > Lustre, I was > given the opportunity to write a quick-start guide that new > developers > such as myself could follow. > > I’m soliciting any input as to what others might want to be included > before submitting my final draft. > > At LUG 2015, Brian Andrus had an excellent presentation that I’m > basing > my document upon and extending > (http://cdn.opensfs.org/wp-content/uploads/2015/04/Lustre-101_Andrus.pdf). > > > My intent is to enable new developers to quickly get a virtual > Lustre > cluster up and running with very little knowledge of Lustre, KVM > or even > specifics of which repositories and packages to pull from to get > things > to “just work”. > > > At the moment, my write up is about 80% complete, and I have a > collection of very simple BASH scripts that bootstraps Centos > 6.6 VM’s > entirely from a local kickstart file with no local installation > media > required (everything is pulled from mirrors.centos.org > > ). I am also setting up YUM in the > VM’s to > prioritise the repos at > https://downloads.hpdd.intel.com/public/lustreand > https://downloads.hpdd.intel.com/public/e2fsprogsahead of > anything else > along with another very simple script that does the the actual > install > and configuration. > > > I chose to document much of the menial steps in scripts as it > serves to > both document what pages of text would attempt to explain and it > gives > the option to “just use it”. > > > Before wrapping this up and presenting the final draft, I am > turning to > the community for any input on things that should be included. > > > Thank you! > > John Suykerbuyk > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > From jsimmons at infradead.org Wed Jun 3 22:38:06 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 3 Jun 2015 18:38:06 -0400 Subject: [lustre-devel] [PATCH v2] staging:lustre: cleanup libcfs lock handling Message-ID: <1433371086-17609-1-git-send-email-jsimmons@infradead.org> Previously with libcfs being built for user land and kernel space wrappers were created to transparently handle locking. Now that user land support has been removed we delete all those locking wrappers with this patch. Many of those changes landed upstream but some nice cleanups still remain that are pushed in this patch. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/13793 Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger --- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +- drivers/staging/lustre/lustre/libcfs/fail.c | 2 +- .../lustre/lustre/libcfs/linux/linux-tracefile.c | 4 +--- drivers/staging/lustre/lustre/libcfs/module.c | 11 ++--------- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 4928f5c..99f8396 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -35,9 +35,9 @@ */ #define DEBUG_SUBSYSTEM S_LNET +#include #include "../../include/linux/lnet/lib-lnet.h" - static int accept_port = 988; static int accept_backlog = 127; static int accept_timeout = 5; diff --git a/drivers/staging/lustre/lustre/libcfs/fail.c b/drivers/staging/lustre/lustre/libcfs/fail.c index 92444b0..7b7fc21 100644 --- a/drivers/staging/lustre/lustre/libcfs/fail.c +++ b/drivers/staging/lustre/lustre/libcfs/fail.c @@ -41,7 +41,7 @@ EXPORT_SYMBOL(cfs_fail_loc); unsigned int cfs_fail_val = 0; EXPORT_SYMBOL(cfs_fail_val); -wait_queue_head_t cfs_race_waitq; +DECLARE_WAIT_QUEUE_HEAD(cfs_race_waitq); EXPORT_SYMBOL(cfs_race_waitq); int cfs_race_state; diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c index 483cbc8..eb10e3b 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c @@ -49,7 +49,7 @@ static unsigned int pages_factor[CFS_TCD_TYPE_MAX] = { char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX]; -struct rw_semaphore cfs_tracefile_sem; +static DECLARE_RWSEM(cfs_tracefile_sem); int cfs_tracefile_init_arch(void) { @@ -57,8 +57,6 @@ int cfs_tracefile_init_arch(void) int j; struct cfs_trace_cpu_data *tcd; - init_rwsem(&cfs_tracefile_sem); - /* initialize trace_data */ memset(cfs_trace_data, 0, sizeof(cfs_trace_data)); for (i = 0; i < CFS_TCD_TYPE_MAX; i++) { diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 83b1a70..e60b2e9 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -66,8 +66,6 @@ MODULE_DESCRIPTION("Portals v3.1"); MODULE_LICENSE("GPL"); extern struct miscdevice libcfs_dev; -extern struct rw_semaphore cfs_tracefile_sem; -extern struct mutex cfs_trace_thread_mutex; extern struct cfs_wi_sched *cfs_sched_rehash; extern void libcfs_init_nidstrings(void); @@ -248,8 +246,8 @@ static int libcfs_psdev_release(unsigned long flags, void *args) return 0; } -static struct rw_semaphore ioctl_list_sem; -static struct list_head ioctl_list; +static DECLARE_RWSEM(ioctl_list_sem); +static LIST_HEAD(ioctl_list); int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand) { @@ -392,11 +390,6 @@ static int init_libcfs_module(void) libcfs_arch_init(); libcfs_init_nidstrings(); - init_rwsem(&cfs_tracefile_sem); - mutex_init(&cfs_trace_thread_mutex); - init_rwsem(&ioctl_list_sem); - INIT_LIST_HEAD(&ioctl_list); - init_waitqueue_head(&cfs_race_waitq); rc = libcfs_debug_init(5 * 1024 * 1024); if (rc < 0) { diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index c86394f..6ee2adc 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -52,7 +52,7 @@ union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline char cfs_tracefile[TRACEFILE_NAME_SIZE]; long long cfs_tracefile_size = CFS_TRACEFILE_SIZE; static struct tracefiled_ctl trace_tctl; -struct mutex cfs_trace_thread_mutex; +static DEFINE_MUTEX(cfs_trace_thread_mutex); static int thread_running; static atomic_t cfs_tage_allocated = ATOMIC_INIT(0); -- 1.7.1 From bass6 at llnl.gov Wed Jun 3 22:49:01 2015 From: bass6 at llnl.gov (Ned Bass) Date: Wed, 3 Jun 2015 15:49:01 -0700 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <116ba3cddacd422ca0f9b597c691f5df@EXCHCS32.ornl.gov> References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> <556F6341.3070507@cray.com> <116ba3cddacd422ca0f9b597c691f5df@EXCHCS32.ornl.gov> Message-ID: <20150603224901.GB10033@llnl.gov> On Wed, Jun 03, 2015 at 09:07:11PM +0000, Simmons, James A. wrote: > >You say you just install the library and not the utils, but do you > >specifically build without the utils? Is there some existing config > >option for that? (Hoping to save myself some grepping...) Otherwise, > >I'll have to add in that option. > > > >It also seems that readline-devel isn't available for the Intel Xeon Phi > >chips (or at least Cray doesn't have it in our build setup). > > This is just papering over the real problem. The utilites should be using > getopt() instead. The only thing Parse does that is non standard is > an interactive command line. The only place I have ever used that is > for lnet selftest. Does lfs really need an interactive command line? > I think not. I concur. There a few lctl commands that can only be run today in the interactive mode because they rely on earlier commands. For example, "conn_list" requires that you first run "network". Such commands should be updated to use sub-arguments rather than relying on previous commands. Ned From peter.a.jones at intel.com Wed Jun 3 23:44:46 2015 From: peter.a.jones at intel.com (Jones, Peter A) Date: Wed, 3 Jun 2015 23:44:46 +0000 Subject: [lustre-devel] OpenID 2.0 and Gerrit 2.11 In-Reply-To: References: <556F5BA7.1020301@llnl.gov> <1637F3AC-75FF-4EEC-8777-4FBF9FCDB60B@intel.com> <556F7078.1020407@llnl.gov> Message-ID: Colin In answer to your original question, no, we do not have an ETA yet for upgrading to gerrit 2.11, but we’ll certainly get to it eventually. Due to the aforementioned earlier limitations I think that those actively working on Lustre development have moved away from relying on Google logins. Once we have upgraded we can certainly experiment and see what exactly is possible. Peter On 6/3/15, 2:25 PM, "Colin Faber" > wrote: I believe that's the case from what I understand. On Wed, Jun 3, 2015 at 3:24 PM, Christopher J. Morrone > wrote: Is it perhaps that gerrit doesn't entirely support it natively, but there is an external gerrit plugin (gerrit-oauth-provier) that makes it work with gerrit 2.10.3.1 or 2.11? Their documentation is none too clear. Chris On 06/03/2015 01:14 PM, Read, Robert wrote: Right, we need OAuth2, which is what Google calls Google OpenID Connect. It looks this has been addressed as of Gerrit 2.10.2. https://code.google.com/p/gerrit/issues/detail?id=2677 robert On Jun 3, 2015, at 13:03 , Colin Faber >> wrote: Hi Chris, >From what I can tell, the OAuth2 and OpenID 2.0 combo does work for google account authentication against gerrit: http://gerrit.cloudlinux.com:8080/login/%23%2Fq%2Fstatus%3Aopen -cf On Wed, Jun 3, 2015 at 1:55 PM, Christopher J. Morrone >> wrote: I think you might have that backwards. Google has _stopped_ supporting OpenID 2.0. To the best of my knowledge no version of gerrit yet supports Google's new OpenID Connect system. Chris On 06/03/2015 12:52 PM, Colin Faber wrote: Hi, This is probably more a question for the folks at Intel.. Is there an ETA or plan in place to upgrade to Gerrit 2.11 and OpenID 2.0? Such changes would allow for google logins to function correctly. -cf _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From sudipm.mukherjee at gmail.com Thu Jun 4 05:35:54 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Thu, 4 Jun 2015 11:05:54 +0530 Subject: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <1433361433-24976-2-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-2-git-send-email-jsimmons@infradead.org> Message-ID: <20150604053554.GB6376@sudip-PC> On Wed, Jun 03, 2015 at 03:57:07PM -0400, James Simmons wrote: > Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c looks like you have not just renamed the file, but there was also a change in the #include which is not mentioned in the commit message. --- drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.old 2015-06-04 11:01:01.862374309 +0530 +++ drivers/staging/lustre/lnet/lnet/lib-socket.c 2015-06-04 11:01:37.082375681 +0530 @@ -35,7 +35,8 @@ */ #define DEBUG_SUBSYSTEM S_LNET -#include "../../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" #include #include regards sudip From sudipm.mukherjee at gmail.com Thu Jun 4 05:57:10 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Thu, 4 Jun 2015 11:27:10 +0530 Subject: [lustre-devel] [PATCH v4 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <1433361433-24976-5-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-5-git-send-email-jsimmons@infradead.org> Message-ID: <20150604055710.GC6376@sudip-PC> On Wed, Jun 03, 2015 at 03:57:10PM -0400, James Simmons wrote: > With all the TCPIP handling done in the lnet layer we should > rename all the functions with the prefix lnet_*. One other > change done was changing the remove argument of lnet_sock_getaddr > from a int to a bool. thats two different change. and apart from this: 1) the function declarations were renamed and moved from lustre/include/linux/libcfs/libcfs.h to drivers/staging/lustre/include/linux/lnet/lib-lnet.h 2) some functions you have changed the coding style. like: - rc = libcfs_sock_getaddr(conn->ksnc_sock, 0, - &conn->ksnc_myipaddr, NULL); + rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL); regards sudip > > Signed-off-by: James Simmons > --- > .../staging/lustre/include/linux/libcfs/libcfs.h | 15 ----- > .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 +++++ > .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- > .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 11 ++-- > .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- > .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 ++--- > .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 ++++++------- > drivers/staging/lustre/lnet/lnet/acceptor.c | 43 ++++++------- > drivers/staging/lustre/lnet/lnet/config.c | 21 +++---- > drivers/staging/lustre/lnet/lnet/lib-socket.c | 66 +++++++++---------- > 10 files changed, 110 insertions(+), 128 deletions(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h > index 457ce9a..5dd9cdf 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h > @@ -65,21 +65,6 @@ static inline int __is_po2(unsigned long long val) > int libcfs_arch_init(void); > void libcfs_arch_cleanup(void); > > -/* libcfs tcpip */ > -int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); > -int libcfs_ipif_enumerate(char ***names); > -void libcfs_ipif_free_enumeration(char **names, int n); > -int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); > -int libcfs_sock_accept(struct socket **newsockp, struct socket *sock); > -int libcfs_sock_connect(struct socket **sockp, int *fatal, > - __u32 local_ip, int local_port, > - __u32 peer_ip, int peer_port); > -int libcfs_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); > -int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); > -int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port); > -int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout); > -int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout); > - > /* need both kernel and user-land acceptor */ > #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512 > #define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023 > diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h > index d84aa9a..ff07703 100644 > --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h > +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h > @@ -844,6 +844,22 @@ int lnet_acceptor_port(void); > int lnet_acceptor_start(void); > void lnet_acceptor_stop(void); > > +int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); > +int lnet_ipif_enumerate(char ***names); > +void lnet_ipif_free_enumeration(char **names, int n); > +int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); > +int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); > +int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port); > +int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout); > +int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout); > + > +int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); > +int lnet_sock_accept(struct socket **newsockp, struct socket *sock); > +int lnet_sock_connect(struct socket **sockp, int *fatal, > + __u32 local_ip, int local_port, > + __u32 peer_ip, int peer_port); > +void libcfs_sock_release(struct socket *sock); > + > void lnet_get_tunables(void); > int lnet_peers_start_down(void); > int lnet_peer_buffer_credits(lnet_ni_t *ni); > diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > index a57c5c3..060b739 100644 > --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > @@ -2617,7 +2617,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname) > int up; > int rc; > > - rc = libcfs_ipif_query(ifname, &up, &ip, &netmask); > + rc = lnet_ipif_query(ifname, &up, &ip, &netmask); > if (rc != 0) { > CERROR("Can't query IPoIB interface %s: %d\n", > ifname, rc); > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c > index 38e831f..ee5cf35 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c > @@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock) > __u32 peer_ip; > int peer_port; > > - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); > + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); > LASSERT(rc == 0); /* we succeeded before */ > > LIBCFS_ALLOC(cr, sizeof(*cr)); > @@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) > int rc; > int n; > > - n = libcfs_ipif_enumerate(&names); > + n = lnet_ipif_enumerate(&names); > if (n <= 0) { > CERROR("Can't enumerate interfaces: %d\n", n); > return n; > @@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) > if (!strcmp(names[i], "lo")) /* skip the loopback IF */ > continue; > > - rc = libcfs_ipif_query(names[i], &up, &ip, &mask); > + rc = lnet_ipif_query(names[i], &up, &ip, &mask); > if (rc != 0) { > CWARN("Can't get interface %s info: %d\n", > names[i], rc); > @@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) > j++; > } > > - libcfs_ipif_free_enumeration(names, n); > + lnet_ipif_free_enumeration(names, n); > > if (j == 0) > CERROR("Can't find any usable interfaces\n"); > @@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni) > if (ni->ni_interfaces[i] == NULL) > break; > > - rc = libcfs_ipif_query( > - ni->ni_interfaces[i], &up, > + rc = lnet_ipif_query(ni->ni_interfaces[i], &up, > &net->ksnn_interfaces[i].ksni_ipaddr, > &net->ksnn_interfaces[i].ksni_netmask); > > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > index a1a4ac0..fe2a83a 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > @@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, > timeout = active ? *ksocknal_tunables.ksnd_timeout : > lnet_acceptor_timeout(); > > - rc = libcfs_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); > + rc = lnet_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); > if (rc != 0) { > CERROR("Error %d reading HELLO from %pI4h\n", > rc, &conn->ksnc_ipaddr); > @@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, > return -EPROTO; > } > > - rc = libcfs_sock_read(sock, &hello->kshm_version, > - sizeof(hello->kshm_version), timeout); > + rc = lnet_sock_read(sock, &hello->kshm_version, > + sizeof(hello->kshm_version), timeout); > if (rc != 0) { > CERROR("Error %d reading HELLO from %pI4h\n", > rc, &conn->ksnc_ipaddr); > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c > index caeb347..34c6a72 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c > @@ -39,9 +39,8 @@ > int > ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) > { > - int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1, > - &conn->ksnc_ipaddr, > - &conn->ksnc_port); > + int rc = lnet_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr, > + &conn->ksnc_port); > > /* Didn't need the {get,put}connsock dance to deref ksnc_sock... */ > LASSERT(!conn->ksnc_closing); > @@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) > return rc; > } > > - rc = libcfs_sock_getaddr(conn->ksnc_sock, 0, > - &conn->ksnc_myipaddr, NULL); > + rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL); > if (rc != 0) { > CERROR("Error %d getting sock local IP\n", rc); > return rc; > @@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int * > return -ESHUTDOWN; > } > > - rc = libcfs_sock_getbuf(sock, txmem, rxmem); > + rc = lnet_sock_getbuf(sock, txmem, rxmem); > if (rc == 0) { > len = sizeof(*nagle); > rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY, > @@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock) > } > } > > - rc = libcfs_sock_setbuf(sock, > - *ksocknal_tunables.ksnd_tx_buffer_size, > - *ksocknal_tunables.ksnd_rx_buffer_size); > + rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size, > + *ksocknal_tunables.ksnd_rx_buffer_size); > if (rc != 0) { > CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", > *ksocknal_tunables.ksnd_tx_buffer_size, > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c > index 1938d6a..986bce4 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c > @@ -495,9 +495,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) > hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype); > hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation); > > - rc = libcfs_sock_write(sock, hdr, sizeof(*hdr), > - lnet_acceptor_timeout()); > - > + rc = lnet_sock_write(sock, hdr, sizeof(*hdr), lnet_acceptor_timeout()); > if (rc != 0) { > CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", > rc, &conn->ksnc_ipaddr, conn->ksnc_port); > @@ -511,9 +509,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) > hello->kshm_ips[i] = __cpu_to_le32 (hello->kshm_ips[i]); > } > > - rc = libcfs_sock_write(sock, hello->kshm_ips, > - hello->kshm_nips * sizeof(__u32), > - lnet_acceptor_timeout()); > + rc = lnet_sock_write(sock, hello->kshm_ips, > + hello->kshm_nips * sizeof(__u32), > + lnet_acceptor_timeout()); > if (rc != 0) { > CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", > rc, hello->kshm_nips, > @@ -544,9 +542,8 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) > LNET_UNLOCK(); > } > > - rc = libcfs_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), > - lnet_acceptor_timeout()); > - > + rc = lnet_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), > + lnet_acceptor_timeout()); > if (rc != 0) { > CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", > rc, &conn->ksnc_ipaddr, conn->ksnc_port); > @@ -556,9 +553,9 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) > if (hello->kshm_nips == 0) > return 0; > > - rc = libcfs_sock_write(sock, hello->kshm_ips, > - hello->kshm_nips * sizeof(__u32), > - lnet_acceptor_timeout()); > + rc = lnet_sock_write(sock, hello->kshm_ips, > + hello->kshm_nips * sizeof(__u32), > + lnet_acceptor_timeout()); > if (rc != 0) { > CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", > rc, hello->kshm_nips, > @@ -583,9 +580,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, > return -ENOMEM; > } > > - rc = libcfs_sock_read(sock, &hdr->src_nid, > - sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), > - timeout); > + rc = lnet_sock_read(sock, &hdr->src_nid, > + sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), > + timeout); > if (rc != 0) { > CERROR("Error %d reading rest of HELLO hdr from %pI4h\n", > rc, &conn->ksnc_ipaddr); > @@ -619,8 +616,8 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, > if (hello->kshm_nips == 0) > goto out; > > - rc = libcfs_sock_read(sock, hello->kshm_ips, > - hello->kshm_nips * sizeof(__u32), timeout); > + rc = lnet_sock_read(sock, hello->kshm_ips, > + hello->kshm_nips * sizeof(__u32), timeout); > if (rc != 0) { > CERROR("Error %d reading IPs from ip %pI4h\n", > rc, &conn->ksnc_ipaddr); > @@ -656,10 +653,10 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout > else > conn->ksnc_flip = 1; > > - rc = libcfs_sock_read(sock, &hello->kshm_src_nid, > - offsetof(ksock_hello_msg_t, kshm_ips) - > - offsetof(ksock_hello_msg_t, kshm_src_nid), > - timeout); > + rc = lnet_sock_read(sock, &hello->kshm_src_nid, > + offsetof(ksock_hello_msg_t, kshm_ips) - > + offsetof(ksock_hello_msg_t, kshm_src_nid), > + timeout); > if (rc != 0) { > CERROR("Error %d reading HELLO from %pI4h\n", > rc, &conn->ksnc_ipaddr); > @@ -687,8 +684,8 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout > if (hello->kshm_nips == 0) > return 0; > > - rc = libcfs_sock_read(sock, hello->kshm_ips, > - hello->kshm_nips * sizeof(__u32), timeout); > + rc = lnet_sock_read(sock, hello->kshm_ips, > + hello->kshm_nips * sizeof(__u32), timeout); > if (rc != 0) { > CERROR("Error %d reading IPs from ip %pI4h\n", > rc, &conn->ksnc_ipaddr); > diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c > index 5187e65..1dc7c8a 100644 > --- a/drivers/staging/lustre/lnet/lnet/acceptor.c > +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c > @@ -155,9 +155,8 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, > --port) { > /* Iterate through reserved ports. */ > > - rc = libcfs_sock_connect(&sock, &fatal, > - local_ip, port, > - peer_ip, peer_port); > + rc = lnet_sock_connect(&sock, &fatal, local_ip, port, peer_ip, > + peer_port); > if (rc != 0) { > if (fatal) > goto failed; > @@ -184,8 +183,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, > lnet_net_unlock(LNET_LOCK_EX); > } > > - rc = libcfs_sock_write(sock, &cr, sizeof(cr), > - accept_timeout); > + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); > if (rc != 0) > goto failed_sock; > > @@ -220,7 +218,7 @@ lnet_accept(struct socket *sock, __u32 magic) > > LASSERT(sizeof(cr) <= 16); /* not too big for the stack */ > > - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); > + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); > LASSERT(rc == 0); /* we succeeded before */ > > if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) { > @@ -234,8 +232,8 @@ lnet_accept(struct socket *sock, __u32 magic) > memset(&cr, 0, sizeof(cr)); > cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; > cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; > - rc = libcfs_sock_write(sock, &cr, sizeof(cr), > - accept_timeout); > + rc = lnet_sock_write(sock, &cr, sizeof(cr), > + accept_timeout); > > if (rc != 0) > CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n", > @@ -257,9 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic) > > flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC); > > - rc = libcfs_sock_read(sock, &cr.acr_version, > - sizeof(cr.acr_version), > - accept_timeout); > + rc = lnet_sock_read(sock, &cr.acr_version, sizeof(cr.acr_version), > + accept_timeout); > if (rc != 0) { > CERROR("Error %d reading connection request version from %pI4h\n", > rc, &peer_ip); > @@ -280,19 +277,17 @@ lnet_accept(struct socket *sock, __u32 magic) > cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; > cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; > > - rc = libcfs_sock_write(sock, &cr, sizeof(cr), > - accept_timeout); > - > + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); > if (rc != 0) > CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n", > peer_version, &peer_ip, rc); > return -EPROTO; > } > > - rc = libcfs_sock_read(sock, &cr.acr_nid, > - sizeof(cr) - > - offsetof(lnet_acceptor_connreq_t, acr_nid), > - accept_timeout); > + rc = lnet_sock_read(sock, &cr.acr_nid, > + sizeof(cr) - > + offsetof(lnet_acceptor_connreq_t, acr_nid), > + accept_timeout); > if (rc != 0) { > CERROR("Error %d reading connection request from %pI4h\n", > rc, &peer_ip); > @@ -343,8 +338,8 @@ lnet_acceptor(void *arg) > > cfs_block_allsigs(); > > - rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock, > - 0, accept_port, accept_backlog); > + rc = lnet_sock_listen(&lnet_acceptor_state.pta_sock, 0, accept_port, > + accept_backlog); > if (rc != 0) { > if (rc == -EADDRINUSE) > LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n", > @@ -367,7 +362,7 @@ lnet_acceptor(void *arg) > > while (!lnet_acceptor_state.pta_shutdown) { > > - rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock); > + rc = lnet_sock_accept(&newsock, lnet_acceptor_state.pta_sock); > if (rc != 0) { > if (rc != -EAGAIN) { > CWARN("Accept error %d: pausing...\n", rc); > @@ -383,7 +378,7 @@ lnet_acceptor(void *arg) > break; > } > > - rc = libcfs_sock_getaddr(newsock, 1, &peer_ip, &peer_port); > + rc = lnet_sock_getaddr(newsock, 1, &peer_ip, &peer_port); > if (rc != 0) { > CERROR("Can't determine new connection's address\n"); > goto failed; > @@ -395,8 +390,8 @@ lnet_acceptor(void *arg) > goto failed; > } > > - rc = libcfs_sock_read(newsock, &magic, sizeof(magic), > - accept_timeout); > + rc = lnet_sock_read(newsock, &magic, sizeof(magic), > + accept_timeout); > if (rc != 0) { > CERROR("Error %d reading connection request from %pI4h\n", > rc, &peer_ip); > diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c > index 70bc809..efbb74a 100644 > --- a/drivers/staging/lustre/lnet/lnet/config.c > +++ b/drivers/staging/lustre/lnet/lnet/config.c > @@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) > __u32 *ipaddrs2; > int nip; > char **ifnames; > - int nif = libcfs_ipif_enumerate(&ifnames); > + int nif = lnet_ipif_enumerate(&ifnames); > int i; > int rc; > > @@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) > LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs)); > if (ipaddrs == NULL) { > CERROR("Can't allocate ipaddrs[%d]\n", nif); > - libcfs_ipif_free_enumeration(ifnames, nif); > + lnet_ipif_free_enumeration(ifnames, nif); > return -ENOMEM; > } > > @@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) > if (!strcmp(ifnames[i], "lo")) > continue; > > - rc = libcfs_ipif_query(ifnames[i], &up, > - &ipaddrs[nip], &netmask); > + rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask); > if (rc != 0) { > CWARN("Can't query interface %s: %d\n", > ifnames[i], rc); > @@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) > nip++; > } > > - libcfs_ipif_free_enumeration(ifnames, nif); > + lnet_ipif_free_enumeration(ifnames, nif); > > if (nip == nif) { > *ipaddrsp = ipaddrs; > @@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) > return -EPERM; > } > > - rc = libcfs_ipif_query(ni->ni_interfaces[0], > - &up, &ip, &netmask); > + rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask); > if (rc != 0) { > CERROR("Net %s can't query interface %s: %d\n", > libcfs_net2str(net), ni->ni_interfaces[0], rc); > @@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) > return 0; > } > > - n = libcfs_ipif_enumerate(&names); > + n = lnet_ipif_enumerate(&names); > if (n <= 0) { > CERROR("Net %s can't enumerate interfaces: %d\n", > libcfs_net2str(net), n); > @@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) > if (!strcmp(names[i], "lo")) /* skip the loopback IF */ > continue; > > - rc = libcfs_ipif_query(names[i], &up, &ip, &netmask); > - > + rc = lnet_ipif_query(names[i], &up, &ip, &netmask); > if (rc != 0) { > CWARN("Net %s can't query interface %s: %d\n", > libcfs_net2str(net), names[i], rc); > @@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) > continue; > } > > - libcfs_ipif_free_enumeration(names, n); > + lnet_ipif_free_enumeration(names, n); > ni->ni_nid = LNET_MKNID(net, ip); > return 0; > } > > CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net)); > - libcfs_ipif_free_enumeration(names, n); > + lnet_ipif_free_enumeration(names, n); > return -ENOENT; > } > EXPORT_SYMBOL(lnet_set_ip_niaddr); > diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c > index bb8d9c2..2e87168 100644 > --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c > +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c > @@ -45,7 +45,7 @@ > #include > > static int > -libcfs_sock_ioctl(int cmd, unsigned long arg) > +lnet_sock_ioctl(int cmd, unsigned long arg) > { > mm_segment_t oldmm = get_fs(); > struct socket *sock; > @@ -76,7 +76,7 @@ out: > } > > int > -libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) > +lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) > { > struct ifreq ifr; > int nob; > @@ -92,8 +92,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) > CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); > > strcpy(ifr.ifr_name, name); > - rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); > - > + rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); > if (rc != 0) { > CERROR("Can't get flags for interface %s\n", name); > return rc; > @@ -110,8 +109,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) > > strcpy(ifr.ifr_name, name); > ifr.ifr_addr.sa_family = AF_INET; > - rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); > - > + rc = lnet_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); > if (rc != 0) { > CERROR("Can't get IP address for interface %s\n", name); > return rc; > @@ -122,8 +120,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) > > strcpy(ifr.ifr_name, name); > ifr.ifr_addr.sa_family = AF_INET; > - rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); > - > + rc = lnet_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); > if (rc != 0) { > CERROR("Can't get netmask for interface %s\n", name); > return rc; > @@ -135,10 +132,10 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) > return 0; > } > > -EXPORT_SYMBOL(libcfs_ipif_query); > +EXPORT_SYMBOL(lnet_ipif_query); > > int > -libcfs_ipif_enumerate (char ***namesp) > +lnet_ipif_enumerate (char ***namesp) > { > /* Allocate and fill in 'names', returning # interfaces/error */ > char **names; > @@ -172,8 +169,7 @@ libcfs_ipif_enumerate (char ***namesp) > ifc.ifc_buf = (char *)ifr; > ifc.ifc_len = nalloc * sizeof(*ifr); > > - rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); > - > + rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); > if (rc < 0) { > CERROR ("Error %d enumerating interfaces\n", rc); > goto out1; > @@ -226,17 +222,17 @@ libcfs_ipif_enumerate (char ***namesp) > > out2: > if (rc < 0) > - libcfs_ipif_free_enumeration(names, nfound); > + lnet_ipif_free_enumeration(names, nfound); > out1: > LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); > out0: > return rc; > } > > -EXPORT_SYMBOL(libcfs_ipif_enumerate); > +EXPORT_SYMBOL(lnet_ipif_enumerate); > > void > -libcfs_ipif_free_enumeration (char **names, int n) > +lnet_ipif_free_enumeration (char **names, int n) > { > int i; > > @@ -248,10 +244,10 @@ libcfs_ipif_free_enumeration (char **names, int n) > LIBCFS_FREE(names, n * sizeof(*names)); > } > > -EXPORT_SYMBOL(libcfs_ipif_free_enumeration); > +EXPORT_SYMBOL(lnet_ipif_free_enumeration); > > int > -libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) > +lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) > { > int rc; > long ticks = timeout * HZ; > @@ -310,10 +306,10 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) > > return 0; > } > -EXPORT_SYMBOL(libcfs_sock_write); > +EXPORT_SYMBOL(lnet_sock_write); > > int > -libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) > +lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) > { > int rc; > long ticks = timeout * HZ; > @@ -366,10 +362,10 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) > } > } > > -EXPORT_SYMBOL(libcfs_sock_read); > +EXPORT_SYMBOL(lnet_sock_read); > > static int > -libcfs_sock_create (struct socket **sockp, int *fatal, > +lnet_sock_create (struct socket **sockp, int *fatal, > __u32 local_ip, int local_port) > { > struct sockaddr_in locaddr; > @@ -424,7 +420,7 @@ libcfs_sock_create (struct socket **sockp, int *fatal, > } > > int > -libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) > +lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) > { > int option; > int rc; > @@ -454,10 +450,10 @@ libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) > return 0; > } > > -EXPORT_SYMBOL(libcfs_sock_setbuf); > +EXPORT_SYMBOL(lnet_sock_setbuf); > > int > -libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) > +lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) > { > struct sockaddr_in sin; > int len = sizeof (sin); > @@ -480,10 +476,10 @@ libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) > return 0; > } > > -EXPORT_SYMBOL(libcfs_sock_getaddr); > +EXPORT_SYMBOL(lnet_sock_getaddr); > > int > -libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) > +lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) > { > > if (txbufsize != NULL) { > @@ -497,16 +493,16 @@ libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) > return 0; > } > > -EXPORT_SYMBOL(libcfs_sock_getbuf); > +EXPORT_SYMBOL(lnet_sock_getbuf); > > int > -libcfs_sock_listen (struct socket **sockp, > +lnet_sock_listen (struct socket **sockp, > __u32 local_ip, int local_port, int backlog) > { > int fatal; > int rc; > > - rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); > + rc = lnet_sock_create(sockp, &fatal, local_ip, local_port); > if (rc != 0) { > if (!fatal) > CERROR("Can't create socket: port %d already in use\n", > @@ -523,10 +519,10 @@ libcfs_sock_listen (struct socket **sockp, > return rc; > } > > -EXPORT_SYMBOL(libcfs_sock_listen); > +EXPORT_SYMBOL(lnet_sock_listen); > > int > -libcfs_sock_accept (struct socket **newsockp, struct socket *sock) > +lnet_sock_accept (struct socket **newsockp, struct socket *sock) > { > wait_queue_t wait; > struct socket *newsock; > @@ -566,17 +562,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) > return rc; > } > > -EXPORT_SYMBOL(libcfs_sock_accept); > +EXPORT_SYMBOL(lnet_sock_accept); > > int > -libcfs_sock_connect (struct socket **sockp, int *fatal, > +lnet_sock_connect (struct socket **sockp, int *fatal, > __u32 local_ip, int local_port, > __u32 peer_ip, int peer_port) > { > struct sockaddr_in srvaddr; > int rc; > > - rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); > + rc = lnet_sock_create(sockp, fatal, local_ip, local_port); > if (rc != 0) > return rc; > > @@ -605,4 +601,4 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, > return rc; > } > > -EXPORT_SYMBOL(libcfs_sock_connect); > +EXPORT_SYMBOL(lnet_sock_connect); > -- > 1.7.1 > > _______________________________________________ > devel mailing list > devel at linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel From sudipm.mukherjee at gmail.com Thu Jun 4 06:02:47 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Thu, 4 Jun 2015 11:32:47 +0530 Subject: [lustre-devel] [PATCH v4 6/7] staging:lustre: style cleanups for lib-socket.c In-Reply-To: <1433361433-24976-7-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-7-git-send-email-jsimmons@infradead.org> Message-ID: <20150604060247.GD6376@sudip-PC> On Wed, Jun 03, 2015 at 03:57:12PM -0400, James Simmons wrote: > Handle all the style issues reported by checkpatch.pl. > Remove general white spaces, spaces in function calls, > etc. > > Signed-off-by: James Simmons > --- > @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp) > if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) { > toobig = 1; > nalloc = PAGE_CACHE_SIZE/sizeof(*ifr); > - CWARN("Too many interfaces: only enumerating first %d\n", > - nalloc); > + CWARN("Too many interfaces: only enumerating " > + "first %d\n", nalloc); oops. Joe told you not to break the user visible strings. The CodingStyle says: "However, never break user-visible strings such as printk messages, because that breaks the ability to grep for them." regards sudip From sudipm.mukherjee at gmail.com Thu Jun 4 06:19:11 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Thu, 4 Jun 2015 11:49:11 +0530 Subject: [lustre-devel] [PATCH v3 8/8] staging:lustre: Update license and copyright for the LNET headers In-Reply-To: <1433364207-14307-9-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-9-git-send-email-jsimmons@infradead.org> Message-ID: <20150604061911.GF6376@sudip-PC> On Wed, Jun 03, 2015 at 04:43:27PM -0400, James Simmons wrote: > Point to the right place for GNU license. Update Intel copyright. > > Signed-off-by: James Simmons is missing regars sudip From dan.carpenter at oracle.com Thu Jun 4 07:34:20 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 4 Jun 2015 10:34:20 +0300 Subject: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <20150604053554.GB6376@sudip-PC> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-2-git-send-email-jsimmons@infradead.org> <20150604053554.GB6376@sudip-PC> Message-ID: <20150604073420.GA28762@mwanda> On Thu, Jun 04, 2015 at 11:05:54AM +0530, Sudip Mukherjee wrote: > On Wed, Jun 03, 2015 at 03:57:07PM -0400, James Simmons wrote: > > Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c > looks like you have not just renamed the file, but there was also a change > in the #include which is not mentioned in the commit message. > That's obviously going to be part of moving the file. regards, dan carpenter From dan.carpenter at oracle.com Thu Jun 4 07:41:07 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 4 Jun 2015 10:41:07 +0300 Subject: [lustre-devel] [PATCH v4 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <20150604055710.GC6376@sudip-PC> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-5-git-send-email-jsimmons@infradead.org> <20150604055710.GC6376@sudip-PC> Message-ID: <20150604074107.GB28762@mwanda> On Thu, Jun 04, 2015 at 11:27:10AM +0530, Sudip Mukherjee wrote: > On Wed, Jun 03, 2015 at 03:57:10PM -0400, James Simmons wrote: > > With all the TCPIP handling done in the lnet layer we should > > rename all the functions with the prefix lnet_*. One other > > change done was changing the remove argument of lnet_sock_getaddr > > from a int to a bool. > thats two different change. > and apart from this: > 1) the function declarations were renamed and moved from > lustre/include/linux/libcfs/libcfs.h to drivers/staging/lustre/include/linux/lnet/lib-lnet.h > > 2) some functions you have changed the coding style. like: > - rc = libcfs_sock_getaddr(conn->ksnc_sock, 0, > - &conn->ksnc_myipaddr, NULL); > + rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL); > Those are tiny related changes. They're fine. When you rename functions you normally have to change the indenting as well. regards, dan carpenter From sudipm.mukherjee at gmail.com Thu Jun 4 07:45:35 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Thu, 4 Jun 2015 13:15:35 +0530 Subject: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <20150604073420.GA28762@mwanda> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-2-git-send-email-jsimmons@infradead.org> <20150604053554.GB6376@sudip-PC> <20150604073420.GA28762@mwanda> Message-ID: <20150604074535.GA6781@sudip-PC> On Thu, Jun 04, 2015 at 10:34:20AM +0300, Dan Carpenter wrote: > On Thu, Jun 04, 2015 at 11:05:54AM +0530, Sudip Mukherjee wrote: > > On Wed, Jun 03, 2015 at 03:57:07PM -0400, James Simmons wrote: > > > Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c > > looks like you have not just renamed the file, but there was also a change > > in the #include which is not mentioned in the commit message. > > > > That's obviously going to be part of moving the file. yes. path changed for libcfs.h. so that was updated. but there was also a new line #include "../../include/linux/lnet/lib-lnet.h" should that be part of moving the file also? regards sudip > > From dan.carpenter at oracle.com Thu Jun 4 07:54:08 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 4 Jun 2015 10:54:08 +0300 Subject: [lustre-devel] [PATCH v4 6/7] staging:lustre: style cleanups for lib-socket.c In-Reply-To: <1433361433-24976-7-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-7-git-send-email-jsimmons@infradead.org> Message-ID: <20150604075408.GC28762@mwanda> On Wed, Jun 03, 2015 at 03:57:12PM -0400, James Simmons wrote: > Handle all the style issues reported by checkpatch.pl. > Remove general white spaces, spaces in function calls, > etc. > What Sudip said but mostly "all the style" issues is a taboo phrase which pretty much gaurantees the change will be rejected. :( regards, dan carpenter From andreas.dilger at intel.com Thu Jun 4 11:21:09 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Thu, 4 Jun 2015 11:21:09 +0000 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <20150603224901.GB10033@llnl.gov> References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> <556F6341.3070507@cray.com> <116ba3cddacd422ca0f9b597c691f5df@EXCHCS32.ornl.gov> <20150603224901.GB10033@llnl.gov> Message-ID: On 2015/06/03, 4:49 PM, "Ned Bass" wrote: >On Wed, Jun 03, 2015 at 09:07:11PM +0000, Simmons, James A. wrote: >> >You say you just install the library and not the utils, but do you >> >specifically build without the utils? Is there some existing config >> >option for that? (Hoping to save myself some grepping...) Otherwise, >> >I'll have to add in that option. >> > >> >It also seems that readline-devel isn't available for the Intel Xeon >>Phi >> >chips (or at least Cray doesn't have it in our build setup). >> >> This is just papering over the real problem. The utilites should be >>using >> getopt() instead. The only thing Parse does that is non standard is >> an interactive command line. The only place I have ever used that is >> for lnet selftest. Does lfs really need an interactive command line? >> I think not. > >I concur. There a few lctl commands that can only be run today in the >interactive mode because they rely on earlier commands. For example, >"conn_list" requires that you first run "network". Such commands should >be updated to use sub-arguments rather than relying on previous >commands. This is handled by having a "command" named "--net" that runs the next command (e.g. "conn_list") so that it can be run from the command-line. That can definitely be replaced by getopt. I don't think interactive mode is used very much anymore, so would probably be ok to remove from lctl. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From bass6 at llnl.gov Thu Jun 4 17:37:26 2015 From: bass6 at llnl.gov (Ned Bass) Date: Thu, 4 Jun 2015 10:37:26 -0700 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> <556F6341.3070507@cray.com> <116ba3cddacd422ca0f9b597c691f5df@EXCHCS32.ornl.gov> <20150603224901.GB10033@llnl.gov> Message-ID: <20150604173726.GC10033@llnl.gov> On Thu, Jun 04, 2015 at 11:21:09AM +0000, Dilger, Andreas wrote: > This is handled by having a "command" named "--net" that runs the next > command (e.g. "conn_list") so that it can be run from the command-line. > That can definitely be replaced by getopt. I don't think interactive mode > is used very much anymore, so would probably be ok to remove from lctl. Cool, thanks. The --net option isn't covered in the lctl man page, but it is in the online help. We'll need to close all those documentation gaps when we gut interactive mode. Ned From bass6 at llnl.gov Thu Jun 4 17:47:52 2015 From: bass6 at llnl.gov (Ned Bass) Date: Thu, 4 Jun 2015 10:47:52 -0700 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <20150604173726.GC10033@llnl.gov> References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> <556F6341.3070507@cray.com> <116ba3cddacd422ca0f9b597c691f5df@EXCHCS32.ornl.gov> <20150603224901.GB10033@llnl.gov> <20150604173726.GC10033@llnl.gov> Message-ID: <20150604174752.GD10033@llnl.gov> On Thu, Jun 04, 2015 at 10:37:26AM -0700, Ned Bass wrote: > > Cool, thanks. The --net option isn't covered in the lctl man page, but > it is in the online help. We'll need to close all those documentation > gaps when we gut interactive mode. Or better yet (getting off topic here) emulate git and have separate man pages for each subcommand, and have 'lfs help ' display the lfs-command man page. From morrone2 at llnl.gov Thu Jun 4 21:21:26 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Thu, 04 Jun 2015 14:21:26 -0700 Subject: [lustre-devel] Lustre 2.8 feature freeze warning Message-ID: <5570C156.8010003@llnl.gov> Hello everyone, Please be aware that the Lustre 2.8 feature freeze is rapidly approaching. After June 30, any unlanded major features will be postponed until a future release. The current schedule for the 2.8.0 release is always available here: http://wiki.lustre.org/Release_2.8.0 Smaller code changes (such as support for new kernels) are generally still permitted until the code freeze date. For 2.8.0, the code freeze date is August 31st. Chris From dan.carpenter at oracle.com Fri Jun 5 09:02:00 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Jun 2015 12:02:00 +0300 Subject: [lustre-devel] [PATCH v3 1/8] staging:lustre: assume a kernel build In-Reply-To: <1433364207-14307-2-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-2-git-send-email-jsimmons@infradead.org> Message-ID: <20150605090200.GL28762@mwanda> This whole patchset looks find to me. Some tips for the future. On Wed, Jun 03, 2015 at 04:43:20PM -0400, James Simmons wrote: > From: John L. Hammond > > In lnet/lnet/ and lnet/selftest/ assume a kernel build (assume that > __KERNEL__ is defined). Remove some common code only needed for user > space LNet. > > - recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, LNET_FL_MAX_MES, > - sizeof(lnet_me_t)); > + recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, 0, 0); When I'm reviewing "delete code" patches, I pretty much focus on the plus lines like this one. Obviously, I can figure out why we changed the parameters to zero but it saves me time if it's spelled out in the changelog. regards, dan carpenter From dan.carpenter at oracle.com Fri Jun 5 09:02:27 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Jun 2015 12:02:27 +0300 Subject: [lustre-devel] [PATCH v3 5/8] staging:lustre: separate kernel and user land defines in the LNet headers In-Reply-To: <1433364207-14307-6-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-6-git-send-email-jsimmons@infradead.org> Message-ID: <20150605090226.GM28762@mwanda> On Wed, Jun 03, 2015 at 04:43:24PM -0400, James Simmons wrote: > Currently the lnet headers used by user land contain various internal > LNet structures that are only used by kernel space. Move the user land > structures to headers used by user land. The kernel structures are > relocated to headers that are never exposed to user land. > > Signed-off-by: James Simmons > --- > diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c > index 1dc7c8a..4928f5c 100644 > --- a/drivers/staging/lustre/lnet/lnet/acceptor.c > +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c > @@ -243,8 +243,6 @@ lnet_accept(struct socket *sock, __u32 magic) > > if (magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC)) > str = "'old' socknal/tcpnal"; > - else if (lnet_accept_magic(magic, LNET_PROTO_RA_MAGIC)) > - str = "'old' ranal"; > else > str = "unrecognised"; > Presumably this was done intentionally. We deleted LNET_PROTO_RA_MAGIC. The changelog was not very clear why. regards, dan carpenter From dan.carpenter at oracle.com Fri Jun 5 09:04:33 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Fri, 5 Jun 2015 12:04:33 +0300 Subject: [lustre-devel] [PATCH v3 7/8] staging:lustre: style cleanups for LNet headers In-Reply-To: <1433364207-14307-8-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-8-git-send-email-jsimmons@infradead.org> Message-ID: <20150605090433.GO28762@mwanda> I'm fine with merging this patch as is. On Wed, Jun 03, 2015 at 04:43:26PM -0400, James Simmons wrote: > + struct lnet_peer *msg_txpeer; /* peer I'm sending to */ > + struct lnet_peer *msg_rxpeer; /* peer I received from */ > + > + void *msg_private; > + struct lnet_libmd *msg_md; > + > + unsigned int msg_len; > + unsigned int msg_wanted; > + unsigned int msg_offset; > + unsigned int msg_niov; > + struct kvec *msg_iov; > + lnet_kiov_t *msg_kiov; > + > + lnet_event_t msg_ev; > + lnet_hdr_t msg_hdr; These aren't in "lustre style". Lustre style is more like: unsigned int msg_len; unsigned int msg_wanted; unsigned int msg_offset; unsigned int msg_niov; struct kvec *msg_iov; lnet_kiov_t *msg_kiov; We're going through and re-indenting things. I think just one space between type and name is the right thing for .c files but you guys really should figure out what style you're using for your header files. regards, dan carpenter From andreas.dilger at intel.com Fri Jun 5 17:15:47 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Fri, 5 Jun 2015 17:15:47 +0000 Subject: [lustre-devel] Lustre and libreadline In-Reply-To: <20150604174752.GD10033@llnl.gov> References: <556F4825.1050408@cray.com> <20150603185716.GA10033@llnl.gov> <556F6341.3070507@cray.com> <116ba3cddacd422ca0f9b597c691f5df@EXCHCS32.ornl.gov> <20150603224901.GB10033@llnl.gov> <20150604173726.GC10033@llnl.gov> <20150604174752.GD10033@llnl.gov> Message-ID: On 2015/06/04, 11:47 AM, "Ned Bass" wrote: >On Thu, Jun 04, 2015 at 10:37:26AM -0700, Ned Bass wrote: >> >> Cool, thanks. The --net option isn't covered in the lctl man page, but >> it is in the online help. We'll need to close all those documentation >> gaps when we gut interactive mode. > >Or better yet (getting off topic here) emulate git and have separate man >pages for each subcommand, and have 'lfs help ' display the >lfs-command man page. See https://jira.hpdd.intel.com/browse/LU-4315 for splitting up the lfs.1 and lctl.8 man pages. That is the kind of project any number of users could take on easily. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From gregkh at linuxfoundation.org Mon Jun 8 19:28:34 2015 From: gregkh at linuxfoundation.org (Greg KH) Date: Mon, 8 Jun 2015 12:28:34 -0700 Subject: [lustre-devel] [PATCH] staging: lustre: cleanup not needed else clauses In-Reply-To: <1433161131-25946-1-git-send-email-antonio.murdaca@gmail.com> References: <1433161131-25946-1-git-send-email-antonio.murdaca@gmail.com> Message-ID: <20150608192834.GA15483@kroah.com> On Mon, Jun 01, 2015 at 02:18:51PM +0200, Antonio Murdaca wrote: > cleanup checkpatch.pl warnings about not needed else > clauses after a break or return > > Signed-off-by: Antonio Murdaca > --- > drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++- > .../staging/lustre/lustre/include/lprocfs_status.h | 3 +- > drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 36 +++++++++++----------- > drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++--- > drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +- > drivers/staging/lustre/lustre/lov/lov_request.c | 3 +- > drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++--- > drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- > drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++-- > drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- > drivers/staging/lustre/lustre/osc/osc_request.c | 14 +++++---- > drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 ++--- > 13 files changed, 50 insertions(+), 59 deletions(-) Doesn't apply to my latest tree :( From antoniomurdaca at gmail.com Mon Jun 8 19:30:35 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 8 Jun 2015 21:30:35 +0200 Subject: [lustre-devel] [PATCH] staging: lustre: cleanup not needed else clauses In-Reply-To: <20150608192834.GA15483@kroah.com> References: <1433161131-25946-1-git-send-email-antonio.murdaca@gmail.com> <20150608192834.GA15483@kroah.com> Message-ID: I'll send a v2 as soon as possible! 2015-06-08 21:28 GMT+02:00 Greg KH : > On Mon, Jun 01, 2015 at 02:18:51PM +0200, Antonio Murdaca wrote: >> cleanup checkpatch.pl warnings about not needed else >> clauses after a break or return >> >> Signed-off-by: Antonio Murdaca >> --- >> drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++- >> .../staging/lustre/lustre/include/lprocfs_status.h | 3 +- >> drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 36 +++++++++++----------- >> drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +- >> drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++--- >> drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +- >> drivers/staging/lustre/lustre/lov/lov_request.c | 3 +- >> drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++--- >> drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- >> drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++-- >> drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- >> drivers/staging/lustre/lustre/osc/osc_request.c | 14 +++++---- >> drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 ++--- >> 13 files changed, 50 insertions(+), 59 deletions(-) > > Doesn't apply to my latest tree :( -- Antonio Murdaca From gregkh at linuxfoundation.org Mon Jun 8 19:33:59 2015 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 8 Jun 2015 12:33:59 -0700 Subject: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <1433361433-24976-2-git-send-email-jsimmons@infradead.org> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-2-git-send-email-jsimmons@infradead.org> Message-ID: <20150608193359.GA1001@kroah.com> On Wed, Jun 03, 2015 at 03:57:07PM -0400, James Simmons wrote: > Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c > > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lnet/lnet/Makefile | 7 +- > drivers/staging/lustre/lnet/lnet/lib-socket.c | 624 ++++++++++++++++++++ > drivers/staging/lustre/lustre/libcfs/Makefile | 1 - > .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 ------------------- > 4 files changed, 628 insertions(+), 627 deletions(-) > create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c > delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Please generate patches in -M format, so I can see the rename properly, as it is, this is too messy for me to review. Please fix up and resend. thanks, greg k-h From gregkh at linuxfoundation.org Mon Jun 8 19:38:26 2015 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 8 Jun 2015 12:38:26 -0700 Subject: [lustre-devel] [PATCH v3 3/8] staging:lustre: delete no longer used LNet headers In-Reply-To: <1433364207-14307-4-git-send-email-jsimmons@infradead.org> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-4-git-send-email-jsimmons@infradead.org> Message-ID: <20150608193826.GA12667@kroah.com> On Wed, Jun 03, 2015 at 04:43:22PM -0400, James Simmons wrote: > Remove the linux specific headers for LNet since they are > mostly empty. Also api-support.h and lnet-sysctl.h is not > needed by anyone. Lastly we delete ptllnd.h and ptllnd_wire.h > which were used by Cray hardware that no longer exist. > With the deletion of the headers some conditionals and > wrappers that no longer exist are handled directly in the > source code. Alongside that some user land router code is > also removed. > > Signed-off-by: James Simmons Doesn't apply to my tree, please refresh and resend this and the rest of this series. thanks, greg k-h From antoniomurdaca at gmail.com Mon Jun 8 19:48:40 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 8 Jun 2015 21:48:40 +0200 Subject: [lustre-devel] [PATCH v2 0/1] staging: lustre: cleanup not needed else clauses Message-ID: <1433792921-10920-1-git-send-email-runcom@linux.com> This patch applies cleanly to staging-next tree Antonio Murdaca (1): staging: lustre: cleanup not needed else clauses drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++--- drivers/staging/lustre/lustre/include/lprocfs_status.h | 3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++++----- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +-- drivers/staging/lustre/lustre/lov/lov_request.c | 3 +-- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++++---- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++---- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++---- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +-- drivers/staging/lustre/lustre/osc/osc_request.c | 14 ++++++++------ drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 +++----- 12 files changed, 32 insertions(+), 41 deletions(-) -- 2.4.3 From antoniomurdaca at gmail.com Mon Jun 8 19:48:41 2015 From: antoniomurdaca at gmail.com (Antonio Murdaca) Date: Mon, 8 Jun 2015 21:48:41 +0200 Subject: [lustre-devel] [PATCH v2 1/1] staging: lustre: cleanup not needed else clauses In-Reply-To: <1433792921-10920-1-git-send-email-runcom@linux.com> References: <1433792921-10920-1-git-send-email-runcom@linux.com> Message-ID: <1433792921-10920-2-git-send-email-runcom@linux.com> From: Antonio Murdaca cleanup checkpatch.pl warnings about not needed else clauses after a break or return Signed-off-by: Antonio Murdaca --- drivers/staging/lustre/lustre/fid/fid_request.c | 5 ++--- drivers/staging/lustre/lustre/include/lprocfs_status.h | 3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 ++++++----- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 +-- drivers/staging/lustre/lustre/lov/lov_request.c | 3 +-- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++++---- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++---- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 ++---- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +-- drivers/staging/lustre/lustre/osc/osc_request.c | 14 ++++++++------ drivers/staging/lustre/lustre/ptlrpc/pinger.c | 8 +++----- 12 files changed, 32 insertions(+), 41 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 7b4e3c6..1362783 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -203,10 +203,9 @@ static int seq_client_alloc_seq(const struct lu_env *env, CERROR("%s: Can't allocate new meta-sequence, rc %d\n", seq->lcs_name, rc); return rc; - } else { - CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", - seq->lcs_name, PRANGE(&seq->lcs_space)); } + CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", + seq->lcs_name, PRANGE(&seq->lcs_space)); } else { rc = 0; } diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 3292fd3..8ede2a0 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -421,9 +421,8 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, else spin_lock(&stats->ls_lock); return 1; - } else { - return stats->ls_biggest_alloc_num; } + return stats->ls_biggest_alloc_num; } } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 0a0b435..764f986 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -667,10 +667,9 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) DEBUG_REQ(D_NET, req, "processing error (%d)", rc); req->rq_status = rc; return ptlrpc_send_error(req, 1); - } else { - DEBUG_REQ(D_NET, req, "sending reply"); } + DEBUG_REQ(D_NET, req, "sending reply"); return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT); } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 6a22f41..bb2246d 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -931,7 +931,9 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else if (lock->l_resource->lr_type == LDLM_IBITS) { + } + + if (lock->l_resource->lr_type == LDLM_IBITS) { for (;;) { policy_end = list_entry(lock->l_sl_policy.prev, @@ -967,11 +969,10 @@ static void search_granted_lock(struct list_head *queue, prev->mode_link = &mode_end->l_sl_mode; prev->policy_link = &req->l_sl_policy; return; - } else { - LDLM_ERROR(lock, - "is not LDLM_PLAIN or LDLM_IBITS lock"); - LBUG(); } + + LDLM_ERROR(lock, "is not LDLM_PLAIN or LDLM_IBITS lock"); + LBUG(); } /* insert point is last lock on the queue, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 310cc60..1605b9c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1401,8 +1401,7 @@ static int ldlm_pools_thread_main(void *arg) if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - else - thread_test_and_clear_flags(thread, SVC_EVENT); + thread_test_and_clear_flags(thread, SVC_EVENT); } thread_set_flags(thread, SVC_STOPPED); diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index f6e1314..8fdfd68 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -617,8 +617,7 @@ void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs, if (tmp & 1) { if (quit) break; - else - quit = 1; + quit = 1; shift = 0; } tmp >>= 1; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index c963941..c23511f 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -75,11 +75,11 @@ static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, if (IS_ERR(c)) { CDEBUG(D_INFO, "alloc capa failed!\n"); return PTR_ERR(c); - } else { - c->c_capa = *capa; - *oc = c; - return 0; } + + c->c_capa = *capa; + *oc = c; + return 0; } static inline int mdc_queue_wait(struct ptlrpc_request *req) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index f13d1fb..163fe0c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -906,10 +906,8 @@ struct lu_env *cl_env_nested_get(struct cl_env_nest *nest) if (env != NULL) { if (!cl_io_is_going(env)) return env; - else { - cl_env_put(env, &nest->cen_refcheck); - nest->cen_cookie = cl_env_reenter(); - } + cl_env_put(env, &nest->cen_refcheck); + nest->cen_cookie = cl_env_reenter(); } env = cl_env_get(&nest->cen_refcheck); if (IS_ERR(env)) { diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c8f6ab0..48dbbcf 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -279,9 +279,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_read(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } up_read(&cathandle->lgh_lock); @@ -299,9 +298,8 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_write(&cathandle->lgh_lock); return loghandle; - } else { - up_write(&loghandle->lgh_lock); } + up_write(&loghandle->lgh_lock); } CDEBUG(D_INODE, "use next log\n"); diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 350ad49..2516e2f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1176,8 +1176,7 @@ static int osc_lock_wait(const struct lu_env *env, /* It is from enqueue RPC reply upcall for * updating state. Do not re-enqueue. */ return -ENAVAIL; - else - olck->ols_state = OLS_NEW; + olck->ols_state = OLS_NEW; } else { LASSERT(lock->cll_error); return lock->cll_error; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 6b6851a..bd26af9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1007,8 +1007,8 @@ static int osc_should_shrink_grant(struct client_obd *client) if (client->cl_import->imp_state == LUSTRE_IMP_FULL && client->cl_avail_grant > brw_size) return 1; - else - osc_update_next_shrink(client); + + osc_update_next_shrink(client); } return 0; } @@ -2300,7 +2300,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, mode); LDLM_LOCK_PUT(matched); return -ECANCELED; - } else if (osc_set_lock_data_with_check(matched, einfo)) { + } + + if (osc_set_lock_data_with_check(matched, einfo)) { *flags |= LDLM_FL_LVB_READY; /* addref the lock only if not async requests and PW * lock is matched whereas we asked for PR. */ @@ -2325,10 +2327,10 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(lockh, einfo->ei_mode); LDLM_LOCK_PUT(matched); return ELDLM_OK; - } else { - ldlm_lock_decref(lockh, mode); - LDLM_LOCK_PUT(matched); } + + ldlm_lock_decref(lockh, mode); + LDLM_LOCK_PUT(matched); } no_match: diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 9fc8156..dc49fbc 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -289,12 +289,10 @@ static int ptlrpc_pinger_main(void *arg) thread_is_stopping(thread) || thread_is_event(thread), &lwi); - if (thread_test_and_clear_flags(thread, SVC_STOPPING)) { + if (thread_test_and_clear_flags(thread, SVC_STOPPING)) break; - } else { - /* woken after adding import to reset timer */ - thread_test_and_clear_flags(thread, SVC_EVENT); - } + /* woken after adding import to reset timer */ + thread_test_and_clear_flags(thread, SVC_EVENT); } } -- 2.4.3 From joe at perches.com Mon Jun 8 19:57:49 2015 From: joe at perches.com (Joe Perches) Date: Mon, 08 Jun 2015 12:57:49 -0700 Subject: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <20150608193359.GA1001@kroah.com> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-2-git-send-email-jsimmons@infradead.org> <20150608193359.GA1001@kroah.com> Message-ID: <1433793469.2730.5.camel@perches.com> On Mon, 2015-06-08 at 12:33 -0700, Greg Kroah-Hartman wrote: > Please generate patches in -M format, so I can see the rename properly, > as it is, this is too messy for me to review. Adding this to the .gitconfig works too [diff] renames = true That should probably be mentioned in SubmittingPatches. Something like: --- Documentation/SubmittingPatches | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 27e7e5e..d86cf89 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@ -715,6 +715,13 @@ the top of the kernel source tree and don't use too much horizontal space (easily fit in 80 columns, maybe with some indentation). (git generates appropriate diffstats by default.) +Another good thing is to generate shorter patches whenever a file rename +has been done. Using "git format-patch -M" does this appropriately. +Adding a [diff] section as below to .gitconfig can also do this: + + [diff] + renames = true + See more details on the proper patch format in the following references. From andreas.dilger at intel.com Tue Jun 9 00:33:50 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 9 Jun 2015 00:33:50 +0000 Subject: [lustre-devel] [PATCH v3 5/8] staging:lustre: separate kernel and user land defines in the LNet headers In-Reply-To: <20150605090226.GM28762@mwanda> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-6-git-send-email-jsimmons@infradead.org> <20150605090226.GM28762@mwanda> Message-ID: On 2015/06/05, 3:02 AM, "Dan Carpenter" wrote: >On Wed, Jun 03, 2015 at 04:43:24PM -0400, James Simmons wrote: >> Currently the lnet headers used by user land contain various internal >> LNet structures that are only used by kernel space. Move the user land >> structures to headers used by user land. The kernel structures are >> relocated to headers that are never exposed to user land. >> >> Signed-off-by: James Simmons >> --- >> diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c >>b/drivers/staging/lustre/lnet/lnet/acceptor.c >> index 1dc7c8a..4928f5c 100644 >> --- a/drivers/staging/lustre/lnet/lnet/acceptor.c >> +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c >> @@ -243,8 +243,6 @@ lnet_accept(struct socket *sock, __u32 magic) >> >> if (magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC)) >> str = "'old' socknal/tcpnal"; >> - else if (lnet_accept_magic(magic, LNET_PROTO_RA_MAGIC)) >> - str = "'old' ranal"; >> else >> str = "unrecognised"; >> > >Presumably this was done intentionally. We deleted LNET_PROTO_RA_MAGIC. >The changelog was not very clear why. The "Rapid Array" network interface is an obsolete network once used by Cray hardware but hasn't been supported for about 10 years and was (mostly) deleted from the tree already. This was just a left-over I guess. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From jsimmons at infradead.org Tue Jun 9 02:27:06 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:06 -0400 Subject: [lustre-devel] [PATCH v5 0/7] staging:lustre: remove tcpip abstraction from libcfs Message-ID: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Since libcfs no longer builds for user land we can move the TCPIP abstraction that exist to the LNET layer which is the only place that uses it. Also the migrated code will use native linux kernel APIs directly instead of with wrappers. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/13760 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Reviewed-by: Oleg Drokin James Simmons (7): staging:lustre: move tcpip abstraction staging:lustre: remove useless libcfs_sock_release staging:lustre: remove useless libcfs_sock_abort_accept staging:lustre: rename tcpip handling functions to lnet_* prefix staging:lustre: use available kernel wrappers in lib-socket.c staging:lustre: lib-socket.c code cleanup - indentation etc staging:lustre: Update license and copyright for lib-socket.c .../staging/lustre/include/linux/libcfs/libcfs.h | 17 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 17 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 +- drivers/staging/lustre/lnet/lnet/Makefile | 7 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 55 +- drivers/staging/lustre/lnet/lnet/config.c | 21 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 594 +++++++++++++++++++ drivers/staging/lustre/lustre/libcfs/Makefile | 1 - .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 -------------------- 14 files changed, 687 insertions(+), 732 deletions(-) create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c From jsimmons at infradead.org Tue Jun 9 02:27:07 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:07 -0400 Subject: [lustre-devel] [PATCH v5 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> References: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433816833-3244-2-git-send-email-jsimmons@infradead.org> Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/Makefile | 7 ++++--- .../linux/linux-tcpip.c => lnet/lnet/lib-socket.c} | 3 ++- drivers/staging/lustre/lustre/libcfs/Makefile | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) rename drivers/staging/lustre/{lustre/libcfs/linux/linux-tcpip.c => lnet/lnet/lib-socket.c} (99%) diff --git a/drivers/staging/lustre/lnet/lnet/Makefile b/drivers/staging/lustre/lnet/lnet/Makefile index 336b8ea..52492fb 100644 --- a/drivers/staging/lustre/lnet/lnet/Makefile +++ b/drivers/staging/lustre/lnet/lnet/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_LNET) += lnet.o -lnet-y := api-ni.o config.o lib-me.o lib-msg.o lib-eq.o \ - lib-md.o lib-ptl.o lib-move.o module.o lo.o router.o \ - router_proc.o acceptor.o peer.o +lnet-y := api-ni.o config.o \ + lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \ + lib-socket.o lib-move.o module.o lo.o \ + router.o router_proc.o acceptor.o peer.o diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c similarity index 99% rename from drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c rename to drivers/staging/lustre/lnet/lnet/lib-socket.c index f2462e7..7f80612 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -35,7 +35,8 @@ */ #define DEBUG_SUBSYSTEM S_LNET -#include "../../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" #include #include diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile b/drivers/staging/lustre/lustre/libcfs/Makefile index fabdd3e..ec98f44 100644 --- a/drivers/staging/lustre/lustre/libcfs/Makefile +++ b/drivers/staging/lustre/lustre/libcfs/Makefile @@ -2,7 +2,6 @@ obj-$(CONFIG_LUSTRE_FS) += libcfs.o libcfs-linux-objs := linux-tracefile.o linux-debug.o libcfs-linux-objs += linux-prim.o linux-cpu.o -libcfs-linux-objs += linux-tcpip.o libcfs-linux-objs += linux-curproc.o libcfs-linux-objs += linux-module.o libcfs-linux-objs += linux-crypto.o -- 1.7.1 From jsimmons at infradead.org Tue Jun 9 02:27:08 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:08 -0400 Subject: [lustre-devel] [PATCH v5 2/7] staging:lustre: remove useless libcfs_sock_release In-Reply-To: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> References: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433816833-3244-3-git-send-email-jsimmons@infradead.org> There is no reason to have a one line exported function libcfs_sock_release. Instead we can call sock_release directly. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 8 ++++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index a789559..f469333 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -80,7 +80,6 @@ int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port); int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout); int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout); -void libcfs_sock_release(struct socket *sock); /* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512 diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 7b5d407..38e831f 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1386,7 +1386,7 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, LIBCFS_FREE(conn, sizeof(*conn)); failed_0: - libcfs_sock_release(sock); + sock_release(sock); return rc; } diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index c34378c..06531c1 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -519,7 +519,7 @@ ksocknal_connsock_decref(ksock_conn_t *conn) LASSERT(atomic_read(&conn->ksnc_sock_refcount) > 0); if (atomic_dec_and_test(&conn->ksnc_sock_refcount)) { LASSERT(conn->ksnc_closing); - libcfs_sock_release(conn->ksnc_sock); + sock_release(conn->ksnc_sock); conn->ksnc_sock = NULL; ksocknal_finalize_zcreq(conn); } diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 954f8d3..1657106 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -197,7 +197,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, goto failed; failed_sock: - libcfs_sock_release(sock); + sock_release(sock); failed: lnet_connect_console_error(rc, peer_nid, peer_ip, peer_port); return rc; @@ -379,7 +379,7 @@ lnet_acceptor(void *arg) /* maybe we're waken up with libcfs_sock_abort_accept() */ if (lnet_acceptor_state.pta_shutdown) { - libcfs_sock_release(newsock); + sock_release(newsock); break; } @@ -410,10 +410,10 @@ lnet_acceptor(void *arg) continue; failed: - libcfs_sock_release(newsock); + sock_release(newsock); } - libcfs_sock_release(lnet_acceptor_state.pta_sock); + sock_release(lnet_acceptor_state.pta_sock); lnet_acceptor_state.pta_sock = NULL; CDEBUG(D_NET, "Acceptor stopping\n"); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 7f80612..259db61 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -614,11 +614,3 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, } EXPORT_SYMBOL(libcfs_sock_connect); - -void -libcfs_sock_release (struct socket *sock) -{ - sock_release(sock); -} - -EXPORT_SYMBOL(libcfs_sock_release); -- 1.7.1 From jsimmons at infradead.org Tue Jun 9 02:27:11 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:11 -0400 Subject: [lustre-devel] [PATCH v5 5/7] staging:lustre: use available kernel wrappers in lib-socket.c In-Reply-To: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> References: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433816833-3244-6-git-send-email-jsimmons@infradead.org> Instead of handling calls to struct proto ourselves we can use equivalent kernel wrappers. No wrapper exist for unlocked ioctl handling so we create one here for our use. I expect some day that function will be integrated into sock.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 47 ++++++++++++++++--------- 1 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 2e87168..2d46a69 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -35,22 +35,37 @@ */ #define DEBUG_SUBSYSTEM S_LNET -#include "../../include/linux/libcfs/libcfs.h" -#include "../../include/linux/lnet/lib-lnet.h" - #include #include +#include #include +#include /* For sys_open & sys_close */ #include +#include + +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" + +static int +kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg) +{ + mm_segment_t oldfs = get_fs(); + int err; + + set_fs(KERNEL_DS); + err = filp->f_op->unlocked_ioctl(filp, cmd, arg); + set_fs(oldfs); + + return err; +} static int lnet_sock_ioctl(int cmd, unsigned long arg) { - mm_segment_t oldmm = get_fs(); + struct file *sock_filp; struct socket *sock; int rc; - struct file *sock_filp; rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); if (rc != 0) { @@ -65,10 +80,7 @@ lnet_sock_ioctl(int cmd, unsigned long arg) goto out; } - set_fs(KERNEL_DS); - if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); - set_fs(oldmm); + rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg); fput(sock_filp); out: @@ -398,8 +410,8 @@ lnet_sock_create (struct socket **sockp, int *fatal, locaddr.sin_addr.s_addr = (local_ip == 0) ? INADDR_ANY : htonl(local_ip); - rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr, - sizeof(locaddr)); + rc = kernel_bind(sock, (struct sockaddr *)&locaddr, + sizeof(locaddr)); if (rc == -EADDRINUSE) { CDEBUG(D_NET, "Port %d already in use\n", local_port); *fatal = 0; @@ -459,8 +471,10 @@ lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) int len = sizeof (sin); int rc; - rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, - remote ? 2 : 0); + if (remote) + rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len); + else + rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len); if (rc != 0) { CERROR ("Error %d getting sock %s IP/port\n", rc, remote ? "peer" : "local"); @@ -510,7 +524,7 @@ lnet_sock_listen (struct socket **sockp, return rc; } - rc = (*sockp)->ops->listen(*sockp, backlog); + rc = kernel_listen(*sockp, backlog); if (rc == 0) return 0; @@ -581,9 +595,8 @@ lnet_sock_connect (struct socket **sockp, int *fatal, srvaddr.sin_port = htons(peer_port); srvaddr.sin_addr.s_addr = htonl(peer_ip); - rc = (*sockp)->ops->connect(*sockp, - (struct sockaddr *)&srvaddr, sizeof(srvaddr), - 0); + rc = kernel_connect(*sockp, (struct sockaddr *)&srvaddr, + sizeof(srvaddr), 0); if (rc == 0) return 0; -- 1.7.1 From jsimmons at infradead.org Tue Jun 9 02:27:12 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:12 -0400 Subject: [lustre-devel] [PATCH v5 6/7] staging:lustre: lib-socket.c code cleanup - indentation etc In-Reply-To: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> References: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433816833-3244-7-git-send-email-jsimmons@infradead.org> Handle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, etc. Signed-off-by: James Simmons --- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 203 +++++++++----------- 2 files changed, 94 insertions(+), 113 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index ee5cf35..4128a92 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1378,14 +1378,14 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, ksocknal_txlist_done(ni, &zombies, 1); ksocknal_peer_decref(peer); - failed_1: +failed_1: if (hello != NULL) LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t, kshm_ips[LNET_MAX_INTERFACES])); LIBCFS_FREE(conn, sizeof(*conn)); - failed_0: +failed_0: sock_release(sock); return rc; } diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 2d46a69..e6dd15b 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -63,13 +63,13 @@ kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg) static int lnet_sock_ioctl(int cmd, unsigned long arg) { - struct file *sock_filp; - struct socket *sock; - int rc; + struct file *sock_filp; + struct socket *sock; + int rc; - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock); if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); + CERROR("Can't create socket: %d\n", rc); return rc; } @@ -88,12 +88,12 @@ out: } int -lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask) { - struct ifreq ifr; - int nob; - int rc; - __u32 val; + struct ifreq ifr; + int nob; + int rc; + __u32 val; nob = strnlen(name, IFNAMSIZ); if (nob == IFNAMSIZ) { @@ -101,7 +101,7 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return -EINVAL; } - CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); + CLASSERT(sizeof(ifr.ifr_name) >= IFNAMSIZ); strcpy(ifr.ifr_name, name); rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); @@ -116,7 +116,6 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) *ip = *mask = 0; return 0; } - *up = 1; strcpy(ifr.ifr_name, name); @@ -143,23 +142,21 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return 0; } - EXPORT_SYMBOL(lnet_ipif_query); int -lnet_ipif_enumerate (char ***namesp) +lnet_ipif_enumerate(char ***namesp) { /* Allocate and fill in 'names', returning # interfaces/error */ - char **names; - int toobig; - int nalloc; - int nfound; - struct ifreq *ifr; - struct ifconf ifc; - int rc; - int nob; - int i; - + char **names; + int toobig; + int nalloc; + int nfound; + struct ifreq *ifr; + struct ifconf ifc; + int rc; + int nob; + int i; nalloc = 16; /* first guess at max interfaces */ toobig = 0; @@ -173,7 +170,8 @@ lnet_ipif_enumerate (char ***namesp) LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr)); if (ifr == NULL) { - CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc); + CERROR("ENOMEM enumerating up to %d interfaces\n", + nalloc); rc = -ENOMEM; goto out0; } @@ -183,14 +181,14 @@ lnet_ipif_enumerate (char ***namesp) rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); if (rc < 0) { - CERROR ("Error %d enumerating interfaces\n", rc); + CERROR("Error %d enumerating interfaces\n", rc); goto out1; } - LASSERT (rc == 0); + LASSERT(rc == 0); nfound = ifc.ifc_len/sizeof(*ifr); - LASSERT (nfound <= nalloc); + LASSERT(nfound <= nalloc); if (nfound < nalloc || toobig) break; @@ -209,8 +207,7 @@ lnet_ipif_enumerate (char ***namesp) } for (i = 0; i < nfound; i++) { - - nob = strnlen (ifr[i].ifr_name, IFNAMSIZ); + nob = strnlen(ifr[i].ifr_name, IFNAMSIZ); if (nob == IFNAMSIZ) { /* no space for terminating NULL */ CERROR("interface name %.*s too long (%d max)\n", @@ -232,41 +229,39 @@ lnet_ipif_enumerate (char ***namesp) *namesp = names; rc = nfound; - out2: +out2: if (rc < 0) lnet_ipif_free_enumeration(names, nfound); - out1: +out1: LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); - out0: +out0: return rc; } - EXPORT_SYMBOL(lnet_ipif_enumerate); void -lnet_ipif_free_enumeration (char **names, int n) +lnet_ipif_free_enumeration(char **names, int n) { - int i; + int i; - LASSERT (n > 0); + LASSERT(n > 0); for (i = 0; i < n && names[i] != NULL; i++) LIBCFS_FREE(names[i], IFNAMSIZ); LIBCFS_FREE(names, n * sizeof(*names)); } - EXPORT_SYMBOL(lnet_ipif_free_enumeration); int -lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout) { - int rc; - long ticks = timeout * HZ; - unsigned long then; + int rc; + long ticks = timeout * HZ; + unsigned long then; struct timeval tv; - LASSERT (nob > 0); + LASSERT(nob > 0); /* Caller may pass a zero timeout if she thinks the socket buffer is * empty enough to take the whole message immediately */ @@ -286,7 +281,7 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) .tv_usec = ((ticks % HZ) * 1000000) / HZ }; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, - (char *)&tv, sizeof(tv)); + (char *)&tv, sizeof(tv)); if (rc != 0) { CERROR("Can't set socket send timeout %ld.%06d: %d\n", (long)tv.tv_sec, (int)tv.tv_usec, rc); @@ -305,7 +300,7 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) return rc; if (rc == 0) { - CERROR ("Unexpected zero rc\n"); + CERROR("Unexpected zero rc\n"); return -ECONNABORTED; } @@ -315,21 +310,20 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) buffer = ((char *)buffer) + rc; nob -= rc; } - return 0; } EXPORT_SYMBOL(lnet_sock_write); int -lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout) { - int rc; - long ticks = timeout * HZ; - unsigned long then; + int rc; + long ticks = timeout * HZ; + unsigned long then; struct timeval tv; - LASSERT (nob > 0); - LASSERT (ticks > 0); + LASSERT(nob > 0); + LASSERT(ticks > 0); for (;;) { struct kvec iov = { @@ -337,7 +331,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) .iov_len = nob }; struct msghdr msg = { - .msg_flags = 0 + .msg_flags = 0 }; /* Set receive timeout to remaining time */ @@ -346,7 +340,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) .tv_usec = ((ticks % HZ) * 1000000) / HZ }; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, - (char *)&tv, sizeof(tv)); + (char *)&tv, sizeof(tv)); if (rc != 0) { CERROR("Can't set socket recv timeout %ld.%06d: %d\n", (long)tv.tv_sec, (int)tv.tv_usec, rc); @@ -373,31 +367,30 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) return -ETIMEDOUT; } } - EXPORT_SYMBOL(lnet_sock_read); static int -lnet_sock_create (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port) +lnet_sock_create(struct socket **sockp, int *fatal, __u32 local_ip, + int local_port) { - struct sockaddr_in locaddr; - struct socket *sock; - int rc; - int option; + struct sockaddr_in locaddr; + struct socket *sock; + int rc; + int option; /* All errors are fatal except bind failure if the port is in use */ *fatal = 1; - rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock); + rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock); *sockp = sock; if (rc != 0) { - CERROR ("Can't create socket: %d\n", rc); + CERROR("Can't create socket: %d\n", rc); return rc; } option = 1; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); goto failed; @@ -423,27 +416,26 @@ lnet_sock_create (struct socket **sockp, int *fatal, goto failed; } } - return 0; - failed: +failed: sock_release(sock); return rc; } int -lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +lnet_sock_setbuf(struct socket *sock, int txbufsize, int rxbufsize) { - int option; - int rc; + int option; + int rc; if (txbufsize != 0) { option = txbufsize; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set send buffer %d: %d\n", - option, rc); + CERROR("Can't set send buffer %d: %d\n", + option, rc); return rc; } } @@ -451,70 +443,63 @@ lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) if (rxbufsize != 0) { option = rxbufsize; rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (char *)&option, sizeof (option)); + (char *)&option, sizeof(option)); if (rc != 0) { - CERROR ("Can't set receive buffer %d: %d\n", - option, rc); + CERROR("Can't set receive buffer %d: %d\n", + option, rc); return rc; } } - return 0; } - EXPORT_SYMBOL(lnet_sock_setbuf); int -lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) +lnet_sock_getaddr(struct socket *sock, bool remote, __u32 *ip, int *port) { struct sockaddr_in sin; - int len = sizeof (sin); - int rc; + int len = sizeof(sin); + int rc; if (remote) rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len); else rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len); if (rc != 0) { - CERROR ("Error %d getting sock %s IP/port\n", - rc, remote ? "peer" : "local"); + CERROR("Error %d getting sock %s IP/port\n", + rc, remote ? "peer" : "local"); return rc; } if (ip != NULL) - *ip = ntohl (sin.sin_addr.s_addr); + *ip = ntohl(sin.sin_addr.s_addr); if (port != NULL) - *port = ntohs (sin.sin_port); + *port = ntohs(sin.sin_port); return 0; } - EXPORT_SYMBOL(lnet_sock_getaddr); int -lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +lnet_sock_getbuf(struct socket *sock, int *txbufsize, int *rxbufsize) { - - if (txbufsize != NULL) { + if (txbufsize != NULL) *txbufsize = sock->sk->sk_sndbuf; - } - if (rxbufsize != NULL) { + if (rxbufsize != NULL) *rxbufsize = sock->sk->sk_rcvbuf; - } return 0; } - EXPORT_SYMBOL(lnet_sock_getbuf); int -lnet_sock_listen (struct socket **sockp, - __u32 local_ip, int local_port, int backlog) +lnet_sock_listen(struct socket **sockp, __u32 local_ip, int local_port, + int backlog) { - int fatal; - int rc; + int fatal; + int rc; rc = lnet_sock_create(sockp, &fatal, local_ip, local_port); if (rc != 0) { @@ -532,15 +517,14 @@ lnet_sock_listen (struct socket **sockp, sock_release(*sockp); return rc; } - EXPORT_SYMBOL(lnet_sock_listen); int -lnet_sock_accept (struct socket **newsockp, struct socket *sock) +lnet_sock_accept(struct socket **newsockp, struct socket *sock) { - wait_queue_t wait; + wait_queue_t wait; struct socket *newsock; - int rc; + int rc; init_waitqueue_entry(&wait, current); @@ -571,26 +555,24 @@ lnet_sock_accept (struct socket **newsockp, struct socket *sock) *newsockp = newsock; return 0; - failed: +failed: sock_release(newsock); return rc; } - EXPORT_SYMBOL(lnet_sock_accept); int -lnet_sock_connect (struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port) +lnet_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, + int local_port, __u32 peer_ip, int peer_port) { - struct sockaddr_in srvaddr; - int rc; + struct sockaddr_in srvaddr; + int rc; rc = lnet_sock_create(sockp, fatal, local_ip, local_port); if (rc != 0) return rc; - memset (&srvaddr, 0, sizeof (srvaddr)); + memset(&srvaddr, 0, sizeof(srvaddr)); srvaddr.sin_family = AF_INET; srvaddr.sin_port = htons(peer_port); srvaddr.sin_addr.s_addr = htonl(peer_ip); @@ -607,11 +589,10 @@ lnet_sock_connect (struct socket **sockp, int *fatal, *fatal = !(rc == -EADDRNOTAVAIL); CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET, - "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, - &local_ip, local_port, &peer_ip, peer_port); + "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc, + &local_ip, local_port, &peer_ip, peer_port); sock_release(*sockp); return rc; } - EXPORT_SYMBOL(lnet_sock_connect); -- 1.7.1 From jsimmons at infradead.org Tue Jun 9 02:27:10 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:10 -0400 Subject: [lustre-devel] [PATCH v5 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix In-Reply-To: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> References: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433816833-3244-5-git-send-email-jsimmons@infradead.org> With all the TCPIP handling done in the lnet layer we should rename all the functions with the prefix lnet_*. One other change done was changing the remove argument of lnet_sock_getaddr from a int to a bool. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 15 ----- .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 +++++ .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 11 ++-- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 ++--- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/acceptor.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/config.c | 21 +++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 66 +++++++++---------- 10 files changed, 110 insertions(+), 128 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 457ce9a..5dd9cdf 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -65,21 +65,6 @@ static inline int __is_po2(unsigned long long val) int libcfs_arch_init(void); void libcfs_arch_cleanup(void); -/* libcfs tcpip */ -int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); -int libcfs_ipif_enumerate(char ***names); -void libcfs_ipif_free_enumeration(char **names, int n); -int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); -int libcfs_sock_accept(struct socket **newsockp, struct socket *sock); -int libcfs_sock_connect(struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port); -int libcfs_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); -int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); -int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port); -int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout); -int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout); - /* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512 #define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023 diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index de9e097..ac3be94 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -639,6 +639,22 @@ int lnet_acceptor_port(void); int lnet_acceptor_start(void); void lnet_acceptor_stop(void); +int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask); +int lnet_ipif_enumerate(char ***names); +void lnet_ipif_free_enumeration(char **names, int n); +int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); +int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); +int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port); +int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout); +int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout); + +int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); +int lnet_sock_accept(struct socket **newsockp, struct socket *sock); +int lnet_sock_connect(struct socket **sockp, int *fatal, + __u32 local_ip, int local_port, + __u32 peer_ip, int peer_port); +void libcfs_sock_release(struct socket *sock); + void lnet_get_tunables(void); int lnet_peers_start_down(void); int lnet_peer_buffer_credits(lnet_ni_t *ni); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index a57c5c3..060b739 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2617,7 +2617,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname) int up; int rc; - rc = libcfs_ipif_query(ifname, &up, &ip, &netmask); + rc = lnet_ipif_query(ifname, &up, &ip, &netmask); if (rc != 0) { CERROR("Can't query IPoIB interface %s: %d\n", ifname, rc); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 38e831f..ee5cf35 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock) __u32 peer_ip; int peer_port; - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); LASSERT(rc == 0); /* we succeeded before */ LIBCFS_ALLOC(cr, sizeof(*cr)); @@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) int rc; int n; - n = libcfs_ipif_enumerate(&names); + n = lnet_ipif_enumerate(&names); if (n <= 0) { CERROR("Can't enumerate interfaces: %d\n", n); return n; @@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) if (!strcmp(names[i], "lo")) /* skip the loopback IF */ continue; - rc = libcfs_ipif_query(names[i], &up, &ip, &mask); + rc = lnet_ipif_query(names[i], &up, &ip, &mask); if (rc != 0) { CWARN("Can't get interface %s info: %d\n", names[i], rc); @@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) j++; } - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); if (j == 0) CERROR("Can't find any usable interfaces\n"); @@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni) if (ni->ni_interfaces[i] == NULL) break; - rc = libcfs_ipif_query( - ni->ni_interfaces[i], &up, + rc = lnet_ipif_query(ni->ni_interfaces[i], &up, &net->ksnn_interfaces[i].ksni_ipaddr, &net->ksnn_interfaces[i].ksni_netmask); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index a1a4ac0..fe2a83a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, timeout = active ? *ksocknal_tunables.ksnd_timeout : lnet_acceptor_timeout(); - rc = libcfs_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); + rc = lnet_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, return -EPROTO; } - rc = libcfs_sock_read(sock, &hello->kshm_version, - sizeof(hello->kshm_version), timeout); + rc = lnet_sock_read(sock, &hello->kshm_version, + sizeof(hello->kshm_version), timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index caeb347..34c6a72 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -39,9 +39,8 @@ int ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) { - int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1, - &conn->ksnc_ipaddr, - &conn->ksnc_port); + int rc = lnet_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr, + &conn->ksnc_port); /* Didn't need the {get,put}connsock dance to deref ksnc_sock... */ LASSERT(!conn->ksnc_closing); @@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) return rc; } - rc = libcfs_sock_getaddr(conn->ksnc_sock, 0, - &conn->ksnc_myipaddr, NULL); + rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL); if (rc != 0) { CERROR("Error %d getting sock local IP\n", rc); return rc; @@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int * return -ESHUTDOWN; } - rc = libcfs_sock_getbuf(sock, txmem, rxmem); + rc = lnet_sock_getbuf(sock, txmem, rxmem); if (rc == 0) { len = sizeof(*nagle); rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY, @@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock) } } - rc = libcfs_sock_setbuf(sock, - *ksocknal_tunables.ksnd_tx_buffer_size, - *ksocknal_tunables.ksnd_rx_buffer_size); + rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size, + *ksocknal_tunables.ksnd_rx_buffer_size); if (rc != 0) { CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", *ksocknal_tunables.ksnd_tx_buffer_size, diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index 1938d6a..986bce4 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -495,9 +495,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype); hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation); - rc = libcfs_sock_write(sock, hdr, sizeof(*hdr), - lnet_acceptor_timeout()); - + rc = lnet_sock_write(sock, hdr, sizeof(*hdr), lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", rc, &conn->ksnc_ipaddr, conn->ksnc_port); @@ -511,9 +509,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hello->kshm_ips[i] = __cpu_to_le32 (hello->kshm_ips[i]); } - rc = libcfs_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), - lnet_acceptor_timeout()); + rc = lnet_sock_write(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips, @@ -544,9 +542,8 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) LNET_UNLOCK(); } - rc = libcfs_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), - lnet_acceptor_timeout()); - + rc = lnet_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n", rc, &conn->ksnc_ipaddr, conn->ksnc_port); @@ -556,9 +553,9 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello) if (hello->kshm_nips == 0) return 0; - rc = libcfs_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), - lnet_acceptor_timeout()); + rc = lnet_sock_write(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), + lnet_acceptor_timeout()); if (rc != 0) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips, @@ -583,9 +580,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, return -ENOMEM; } - rc = libcfs_sock_read(sock, &hdr->src_nid, - sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), - timeout); + rc = lnet_sock_read(sock, &hdr->src_nid, + sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), + timeout); if (rc != 0) { CERROR("Error %d reading rest of HELLO hdr from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -619,8 +616,8 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello, if (hello->kshm_nips == 0) goto out; - rc = libcfs_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + rc = lnet_sock_read(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), timeout); if (rc != 0) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -656,10 +653,10 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout else conn->ksnc_flip = 1; - rc = libcfs_sock_read(sock, &hello->kshm_src_nid, - offsetof(ksock_hello_msg_t, kshm_ips) - - offsetof(ksock_hello_msg_t, kshm_src_nid), - timeout); + rc = lnet_sock_read(sock, &hello->kshm_src_nid, + offsetof(ksock_hello_msg_t, kshm_ips) - + offsetof(ksock_hello_msg_t, kshm_src_nid), + timeout); if (rc != 0) { CERROR("Error %d reading HELLO from %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -687,8 +684,8 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout if (hello->kshm_nips == 0) return 0; - rc = libcfs_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + rc = lnet_sock_read(sock, hello->kshm_ips, + hello->kshm_nips * sizeof(__u32), timeout); if (rc != 0) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 246a583..be85035 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -155,9 +155,8 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, --port) { /* Iterate through reserved ports. */ - rc = libcfs_sock_connect(&sock, &fatal, - local_ip, port, - peer_ip, peer_port); + rc = lnet_sock_connect(&sock, &fatal, local_ip, port, peer_ip, + peer_port); if (rc != 0) { if (fatal) goto failed; @@ -184,8 +183,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, lnet_net_unlock(LNET_LOCK_EX); } - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); if (rc != 0) goto failed_sock; @@ -220,7 +218,7 @@ lnet_accept(struct socket *sock, __u32 magic) LASSERT(sizeof(cr) <= 16); /* not too big for the stack */ - rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); LASSERT(rc == 0); /* we succeeded before */ if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) { @@ -234,8 +232,8 @@ lnet_accept(struct socket *sock, __u32 magic) memset(&cr, 0, sizeof(cr)); cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); + rc = lnet_sock_write(sock, &cr, sizeof(cr), + accept_timeout); if (rc != 0) CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n", @@ -257,9 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic) flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC); - rc = libcfs_sock_read(sock, &cr.acr_version, - sizeof(cr.acr_version), - accept_timeout); + rc = lnet_sock_read(sock, &cr.acr_version, sizeof(cr.acr_version), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request version from %pI4h\n", rc, &peer_ip); @@ -280,19 +277,17 @@ lnet_accept(struct socket *sock, __u32 magic) cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; - rc = libcfs_sock_write(sock, &cr, sizeof(cr), - accept_timeout); - + rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout); if (rc != 0) CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n", peer_version, &peer_ip, rc); return -EPROTO; } - rc = libcfs_sock_read(sock, &cr.acr_nid, - sizeof(cr) - - offsetof(lnet_acceptor_connreq_t, acr_nid), - accept_timeout); + rc = lnet_sock_read(sock, &cr.acr_nid, + sizeof(cr) - + offsetof(lnet_acceptor_connreq_t, acr_nid), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request from %pI4h\n", rc, &peer_ip); @@ -343,8 +338,8 @@ lnet_acceptor(void *arg) cfs_block_allsigs(); - rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock, - 0, accept_port, accept_backlog); + rc = lnet_sock_listen(&lnet_acceptor_state.pta_sock, 0, accept_port, + accept_backlog); if (rc != 0) { if (rc == -EADDRINUSE) LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n", @@ -367,7 +362,7 @@ lnet_acceptor(void *arg) while (!lnet_acceptor_state.pta_shutdown) { - rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock); + rc = lnet_sock_accept(&newsock, lnet_acceptor_state.pta_sock); if (rc != 0) { if (rc != -EAGAIN) { CWARN("Accept error %d: pausing...\n", rc); @@ -383,7 +378,7 @@ lnet_acceptor(void *arg) break; } - rc = libcfs_sock_getaddr(newsock, 1, &peer_ip, &peer_port); + rc = lnet_sock_getaddr(newsock, 1, &peer_ip, &peer_port); if (rc != 0) { CERROR("Can't determine new connection's address\n"); goto failed; @@ -395,8 +390,8 @@ lnet_acceptor(void *arg) goto failed; } - rc = libcfs_sock_read(newsock, &magic, sizeof(magic), - accept_timeout); + rc = lnet_sock_read(newsock, &magic, sizeof(magic), + accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request from %pI4h\n", rc, &peer_ip); diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 70bc809..efbb74a 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) __u32 *ipaddrs2; int nip; char **ifnames; - int nif = libcfs_ipif_enumerate(&ifnames); + int nif = lnet_ipif_enumerate(&ifnames); int i; int rc; @@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs)); if (ipaddrs == NULL) { CERROR("Can't allocate ipaddrs[%d]\n", nif); - libcfs_ipif_free_enumeration(ifnames, nif); + lnet_ipif_free_enumeration(ifnames, nif); return -ENOMEM; } @@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) if (!strcmp(ifnames[i], "lo")) continue; - rc = libcfs_ipif_query(ifnames[i], &up, - &ipaddrs[nip], &netmask); + rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask); if (rc != 0) { CWARN("Can't query interface %s: %d\n", ifnames[i], rc); @@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) nip++; } - libcfs_ipif_free_enumeration(ifnames, nif); + lnet_ipif_free_enumeration(ifnames, nif); if (nip == nif) { *ipaddrsp = ipaddrs; @@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) return -EPERM; } - rc = libcfs_ipif_query(ni->ni_interfaces[0], - &up, &ip, &netmask); + rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask); if (rc != 0) { CERROR("Net %s can't query interface %s: %d\n", libcfs_net2str(net), ni->ni_interfaces[0], rc); @@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) return 0; } - n = libcfs_ipif_enumerate(&names); + n = lnet_ipif_enumerate(&names); if (n <= 0) { CERROR("Net %s can't enumerate interfaces: %d\n", libcfs_net2str(net), n); @@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) if (!strcmp(names[i], "lo")) /* skip the loopback IF */ continue; - rc = libcfs_ipif_query(names[i], &up, &ip, &netmask); - + rc = lnet_ipif_query(names[i], &up, &ip, &netmask); if (rc != 0) { CWARN("Net %s can't query interface %s: %d\n", libcfs_net2str(net), names[i], rc); @@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni) continue; } - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); ni->ni_nid = LNET_MKNID(net, ip); return 0; } CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net)); - libcfs_ipif_free_enumeration(names, n); + lnet_ipif_free_enumeration(names, n); return -ENOENT; } EXPORT_SYMBOL(lnet_set_ip_niaddr); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index bb8d9c2..2e87168 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -45,7 +45,7 @@ #include static int -libcfs_sock_ioctl(int cmd, unsigned long arg) +lnet_sock_ioctl(int cmd, unsigned long arg) { mm_segment_t oldmm = get_fs(); struct socket *sock; @@ -76,7 +76,7 @@ out: } int -libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) +lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) { struct ifreq ifr; int nob; @@ -92,8 +92,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ); strcpy(ifr.ifr_name, name); - rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get flags for interface %s\n", name); return rc; @@ -110,8 +109,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) strcpy(ifr.ifr_name, name); ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get IP address for interface %s\n", name); return rc; @@ -122,8 +120,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) strcpy(ifr.ifr_name, name); ifr.ifr_addr.sa_family = AF_INET; - rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); - + rc = lnet_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr); if (rc != 0) { CERROR("Can't get netmask for interface %s\n", name); return rc; @@ -135,10 +132,10 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask) return 0; } -EXPORT_SYMBOL(libcfs_ipif_query); +EXPORT_SYMBOL(lnet_ipif_query); int -libcfs_ipif_enumerate (char ***namesp) +lnet_ipif_enumerate (char ***namesp) { /* Allocate and fill in 'names', returning # interfaces/error */ char **names; @@ -172,8 +169,7 @@ libcfs_ipif_enumerate (char ***namesp) ifc.ifc_buf = (char *)ifr; ifc.ifc_len = nalloc * sizeof(*ifr); - rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); - + rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); if (rc < 0) { CERROR ("Error %d enumerating interfaces\n", rc); goto out1; @@ -226,17 +222,17 @@ libcfs_ipif_enumerate (char ***namesp) out2: if (rc < 0) - libcfs_ipif_free_enumeration(names, nfound); + lnet_ipif_free_enumeration(names, nfound); out1: LIBCFS_FREE(ifr, nalloc * sizeof(*ifr)); out0: return rc; } -EXPORT_SYMBOL(libcfs_ipif_enumerate); +EXPORT_SYMBOL(lnet_ipif_enumerate); void -libcfs_ipif_free_enumeration (char **names, int n) +lnet_ipif_free_enumeration (char **names, int n) { int i; @@ -248,10 +244,10 @@ libcfs_ipif_free_enumeration (char **names, int n) LIBCFS_FREE(names, n * sizeof(*names)); } -EXPORT_SYMBOL(libcfs_ipif_free_enumeration); +EXPORT_SYMBOL(lnet_ipif_free_enumeration); int -libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout) { int rc; long ticks = timeout * HZ; @@ -310,10 +306,10 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout) return 0; } -EXPORT_SYMBOL(libcfs_sock_write); +EXPORT_SYMBOL(lnet_sock_write); int -libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) +lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout) { int rc; long ticks = timeout * HZ; @@ -366,10 +362,10 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout) } } -EXPORT_SYMBOL(libcfs_sock_read); +EXPORT_SYMBOL(lnet_sock_read); static int -libcfs_sock_create (struct socket **sockp, int *fatal, +lnet_sock_create (struct socket **sockp, int *fatal, __u32 local_ip, int local_port) { struct sockaddr_in locaddr; @@ -424,7 +420,7 @@ libcfs_sock_create (struct socket **sockp, int *fatal, } int -libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) +lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) { int option; int rc; @@ -454,10 +450,10 @@ libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize) return 0; } -EXPORT_SYMBOL(libcfs_sock_setbuf); +EXPORT_SYMBOL(lnet_sock_setbuf); int -libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) +lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port) { struct sockaddr_in sin; int len = sizeof (sin); @@ -480,10 +476,10 @@ libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port) return 0; } -EXPORT_SYMBOL(libcfs_sock_getaddr); +EXPORT_SYMBOL(lnet_sock_getaddr); int -libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) +lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) { if (txbufsize != NULL) { @@ -497,16 +493,16 @@ libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize) return 0; } -EXPORT_SYMBOL(libcfs_sock_getbuf); +EXPORT_SYMBOL(lnet_sock_getbuf); int -libcfs_sock_listen (struct socket **sockp, +lnet_sock_listen (struct socket **sockp, __u32 local_ip, int local_port, int backlog) { int fatal; int rc; - rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port); + rc = lnet_sock_create(sockp, &fatal, local_ip, local_port); if (rc != 0) { if (!fatal) CERROR("Can't create socket: port %d already in use\n", @@ -523,10 +519,10 @@ libcfs_sock_listen (struct socket **sockp, return rc; } -EXPORT_SYMBOL(libcfs_sock_listen); +EXPORT_SYMBOL(lnet_sock_listen); int -libcfs_sock_accept (struct socket **newsockp, struct socket *sock) +lnet_sock_accept (struct socket **newsockp, struct socket *sock) { wait_queue_t wait; struct socket *newsock; @@ -566,17 +562,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) return rc; } -EXPORT_SYMBOL(libcfs_sock_accept); +EXPORT_SYMBOL(lnet_sock_accept); int -libcfs_sock_connect (struct socket **sockp, int *fatal, +lnet_sock_connect (struct socket **sockp, int *fatal, __u32 local_ip, int local_port, __u32 peer_ip, int peer_port) { struct sockaddr_in srvaddr; int rc; - rc = libcfs_sock_create(sockp, fatal, local_ip, local_port); + rc = lnet_sock_create(sockp, fatal, local_ip, local_port); if (rc != 0) return rc; @@ -605,4 +601,4 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, return rc; } -EXPORT_SYMBOL(libcfs_sock_connect); +EXPORT_SYMBOL(lnet_sock_connect); -- 1.7.1 From jsimmons at infradead.org Tue Jun 9 02:27:13 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:13 -0400 Subject: [lustre-devel] [PATCH v5 7/7] staging:lustre: Update license and copyright for lib-socket.c In-Reply-To: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> References: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433816833-3244-8-git-send-email-jsimmons@infradead.org> Point to the right place for GNU license. Update Intel copyright. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index e6dd15b..6f7ef4c 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,11 +23,11 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. */ #define DEBUG_SUBSYSTEM S_LNET -- 1.7.1 From jsimmons at infradead.org Tue Jun 9 02:27:09 2015 From: jsimmons at infradead.org (James Simmons) Date: Mon, 8 Jun 2015 22:27:09 -0400 Subject: [lustre-devel] [PATCH v5 3/7] staging:lustre: remove useless libcfs_sock_abort_accept In-Reply-To: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> References: <1433816833-3244-1-git-send-email-jsimmons@infradead.org> Message-ID: <1433816833-3244-4-git-send-email-jsimmons@infradead.org> Another one of those silly one line wrappers which is not needed. Replace libcfs_sock_abort_accept wrapper with a direct call to wake_up_all on the lnet_acceptor_state sock. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - drivers/staging/lustre/lnet/lnet/acceptor.c | 4 ++-- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index f469333..457ce9a 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -71,7 +71,6 @@ int libcfs_ipif_enumerate(char ***names); void libcfs_ipif_free_enumeration(char **names, int n); int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); int libcfs_sock_accept(struct socket **newsockp, struct socket *sock); -void libcfs_sock_abort_accept(struct socket *sock); int libcfs_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, int local_port, __u32 peer_ip, int peer_port); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 1657106..246a583 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -377,7 +377,7 @@ lnet_acceptor(void *arg) continue; } - /* maybe we're waken up with libcfs_sock_abort_accept() */ + /* maybe the LNet acceptor thread has been waken */ if (lnet_acceptor_state.pta_shutdown) { sock_release(newsock); break; @@ -493,7 +493,7 @@ lnet_acceptor_stop(void) return; lnet_acceptor_state.pta_shutdown = 1; - libcfs_sock_abort_accept(lnet_acceptor_state.pta_sock); + wake_up_all(sk_sleep(lnet_acceptor_state.pta_sock->sk)); /* block until acceptor signals exit */ wait_for_completion(&lnet_acceptor_state.pta_signal); diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 259db61..bb8d9c2 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -568,14 +568,6 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock) EXPORT_SYMBOL(libcfs_sock_accept); -void -libcfs_sock_abort_accept (struct socket *sock) -{ - wake_up_all(sk_sleep(sock->sk)); -} - -EXPORT_SYMBOL(libcfs_sock_abort_accept); - int libcfs_sock_connect (struct socket **sockp, int *fatal, __u32 local_ip, int local_port, -- 1.7.1 From simmonsja at ornl.gov Tue Jun 9 13:38:53 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Tue, 9 Jun 2015 13:38:53 +0000 Subject: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction In-Reply-To: <20150604074535.GA6781@sudip-PC> References: <1433361433-24976-1-git-send-email-jsimmons@infradead.org> <1433361433-24976-2-git-send-email-jsimmons@infradead.org> <20150604053554.GB6376@sudip-PC> <20150604073420.GA28762@mwanda> <20150604074535.GA6781@sudip-PC> Message-ID: <52dddbd6f58e475981a9e19985008ce7@EXCHCS32.ornl.gov> >On Thu, Jun 04, 2015 at 10:34:20AM +0300, Dan Carpenter wrote: >> On Thu, Jun 04, 2015 at 11:05:54AM +0530, Sudip Mukherjee wrote: >> > On Wed, Jun 03, 2015 at 03:57:07PM -0400, James Simmons wrote: >> > > Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c >> > looks like you have not just renamed the file, but there was also a change >> > in the #include which is not mentioned in the commit message. >> > >> >> That's obviously going to be part of moving the file. >yes. path changed for libcfs.h. so that was updated. >but there was also a new line >#include "../../include/linux/lnet/lib-lnet.h" > >should that be part of moving the file also? That is handle the move of some of the LNet function declarations in libcfs.h to lib-lnet.h. That happens in patch number 4 of this series. I was trying to minimize the diff between the tip of the Lustre development branch and the upstream client. From simmonsja at ornl.gov Tue Jun 9 14:59:26 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Tue, 9 Jun 2015 14:59:26 +0000 Subject: [lustre-devel] [PATCH v3 5/8] staging:lustre: separate kernel and user land defines in the LNet headers In-Reply-To: References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-6-git-send-email-jsimmons@infradead.org> <20150605090226.GM28762@mwanda> Message-ID: <8fc5cd45fda6439f9cad8c8a7b504db9@EXCHCS32.ornl.gov> >On 2015/06/05, 3:02 AM, "Dan Carpenter" wrote: > >>On Wed, Jun 03, 2015 at 04:43:24PM -0400, James Simmons wrote: >>> Currently the lnet headers used by user land contain various internal >>> LNet structures that are only used by kernel space. Move the user land >>> structures to headers used by user land. The kernel structures are >>> relocated to headers that are never exposed to user land. >>> >>> Signed-off-by: James Simmons >>> --- >>> diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c >>>b/drivers/staging/lustre/lnet/lnet/acceptor.c >>> index 1dc7c8a..4928f5c 100644 >>> --- a/drivers/staging/lustre/lnet/lnet/acceptor.c >>> +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c >>> @@ -243,8 +243,6 @@ lnet_accept(struct socket *sock, __u32 magic) >>> >>> if (magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC)) >>> str = "'old' socknal/tcpnal"; >>> - else if (lnet_accept_magic(magic, LNET_PROTO_RA_MAGIC)) >>> - str = "'old' ranal"; >>> else >>> str = "unrecognised"; >>> >> >>Presumably this was done intentionally. We deleted LNET_PROTO_RA_MAGIC. >>The changelog was not very clear why. > >The "Rapid Array" network interface is an obsolete network once used by >Cray hardware but hasn't been supported for about 10 years and was (mostly) >deleted from the tree already. This was just a left-over I guess. I need to break this patch up and do a proper backport of the patch from LU-6209. Currently it is mixed in with this header cleanup. From simmonsja at ornl.gov Tue Jun 9 15:01:53 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Tue, 9 Jun 2015 15:01:53 +0000 Subject: [lustre-devel] [PATCH v3 7/8] staging:lustre: style cleanups for LNet headers In-Reply-To: <20150605090433.GO28762@mwanda> References: <1433364207-14307-1-git-send-email-jsimmons@infradead.org> <1433364207-14307-8-git-send-email-jsimmons@infradead.org> <20150605090433.GO28762@mwanda> Message-ID: >We're going through and re-indenting things. I think just one space >between type and name is the right thing for .c files but you guys >really should figure out what style you're using for your header files. This is good to know. I didn't know how you felt about the lustre style. I will fix it up in the next patch. From paf at cray.com Tue Jun 9 20:30:26 2015 From: paf at cray.com (Patrick Farrell) Date: Tue, 9 Jun 2015 15:30:26 -0500 Subject: [lustre-devel] OBD_CONNECT_* flags Message-ID: <55774CE2.30107@cray.com> Good afternoon, Hopefully a fairly quick question... I'm adding a new feature (lock ahead) and would like to use an OBD_CONNECT flag to verify it's supported on the server. I took a quick stab at adding one, but I'm getting lost in the details of how the flags are set and exchanged. Essentially, I would like the client and server (OSS in this case) to both have a particular OBD_CONNECT flag or the client will return -EOPNOTSUPP when the feature (an ioctl) is invoked. So: Is an OBD_CONNECT flag the right way to do this? If so, could anyone give a brief explanation of how that works, or an example to build off of? Thanks, - Patrick Farrell From andreas.dilger at intel.com Wed Jun 10 01:41:35 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 10 Jun 2015 01:41:35 +0000 Subject: [lustre-devel] wiretest.c In-Reply-To: <6E6D936CCB2E3C428716BD24C5C6CDF264330C@CFWEX01.americas.cray.com> References: <6E6D936CCB2E3C428716BD24C5C6CDF264330C@CFWEX01.americas.cray.com> Message-ID: <299328B7-9D13-4854-BA51-2B1F3E1D9358@intel.com> Ben, The point of wiretest.c is that these values should basically never be changed. At compile time these checks should become no-ops unless they have changed, which would be a bug. Cheers, Andreas On Jun 9, 2015, at 13:49, Ben Evans > wrote: I’m trying to help out with the client code merging into the kernel project. The first thing I dove into was ptlrpc, as it’s a space that’s been singled out as needing help. In order to get my head around it, I’m just going through the code, and one of the first things that pops up is wiretest.c, which looks to be checking that things that have been #defined have the values that they are #defined to have, that structures are offset correctly (for a given value of ‘correctly’) etc. So, I’ve started going through wiretest and seeing how much of the things that are defined are actually used in the code, and I find that some just aren’t used at all, or at least not in other places than where they’re defined, and wiretest. HSM_GHOST_COPY is a good example of it. I can’t find any usage in the mainline lustre-release code, or in the drivers/staging/lustre code. Is this the sort of thing that should be flagged for deletion? Secondly, if the code boils down to: #define SOME_VAR 10 and LASSERT(SOME_VAR == 10); What’s the point from a design perspective other than making it mildly more difficult to change? Thanks for any help, or insight you can give -Ben Evans From andreas.dilger at intel.com Wed Jun 10 06:58:02 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 10 Jun 2015 06:58:02 +0000 Subject: [lustre-devel] OBD_CONNECT_* flags In-Reply-To: <55774CE2.30107@cray.com> References: <55774CE2.30107@cray.com> Message-ID: On 2015/06/09, 2:30 PM, "Patrick Farrell" wrote: >Hopefully a fairly quick question... I'm adding a new feature (lock >ahead) and would like to use an OBD_CONNECT flag to verify it's >supported on the server. I took a quick stab at adding one, but I'm >getting lost in the details of how the flags are set and exchanged. > >Essentially, I would like the client and server (OSS in this case) to >both have a particular OBD_CONNECT flag or the client will return >-EOPNOTSUPP when the feature (an ioctl) is invoked. >So: Is an OBD_CONNECT flag the right way to do this? >If so, could anyone give a brief explanation of how that works, or an >example to build off of? The client sets the OBD_CONNECT flags for features it supports before connection to the MDS or OSS (or MGS, but we'll leave that out for now). The server replies with the subset of those flags that it supports, masking the client flags with either the MDS_CONNECT_SUPPORTED or OST_CONNECT_SUPPORTED mask, depending on the service type. The resulting set of flags are features that both the client and server understand. Definitely using OBD_CONNECT flags is the intended way to do this. If this feature only needs to be understood by the OSC and OST, then you are done - the connect flags are stored for each connection. If the llite layer needs to be aware of the feature then this is a bit more complex because the client->OST connections are async and the flags aren't set until the connection is completed. That is fine for checking features as needed during runtime on a particular OST, but not possible if you would need to refuse the mount because of some missing server feature (which I don't think is relevant for your use case). In theory, the OBD_CONNECT flags could be different on a per-OST basis if the OSTs were just being upgraded, but practically this is not the case. For lockahead this seems manageable, since this is just an advisory feature, so it would be OK if the lockahead requests weren't executed for some OSTs. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From bevans at cray.com Wed Jun 10 14:01:06 2015 From: bevans at cray.com (Ben Evans) Date: Wed, 10 Jun 2015 14:01:06 +0000 Subject: [lustre-devel] wiretest.c In-Reply-To: <299328B7-9D13-4854-BA51-2B1F3E1D9358@intel.com> References: <6E6D936CCB2E3C428716BD24C5C6CDF264330C@CFWEX01.americas.cray.com> <299328B7-9D13-4854-BA51-2B1F3E1D9358@intel.com> Message-ID: <6E6D936CCB2E3C428716BD24C5C6CDF26433AA@CFWEX01.americas.cray.com> That much I assumed from context, it just strikes me as a strange way of going about it, since it just adds a second step to change a constant. I figured code reviews would pick that stuff up pretty quickly. Does using it as a method of identifying unused constants make sense to you? -Ben -----Original Message----- From: Dilger, Andreas [mailto:andreas.dilger at intel.com] Sent: Tuesday, June 09, 2015 9:42 PM To: Ben Evans Cc: Drokin, Oleg; lustre-devel at lists.lustre.org Subject: Re: wiretest.c Ben, The point of wiretest.c is that these values should basically never be changed. At compile time these checks should become no-ops unless they have changed, which would be a bug. Cheers, Andreas On Jun 9, 2015, at 13:49, Ben Evans > wrote: I'm trying to help out with the client code merging into the kernel project. The first thing I dove into was ptlrpc, as it's a space that's been singled out as needing help. In order to get my head around it, I'm just going through the code, and one of the first things that pops up is wiretest.c, which looks to be checking that things that have been #defined have the values that they are #defined to have, that structures are offset correctly (for a given value of 'correctly') etc. So, I've started going through wiretest and seeing how much of the things that are defined are actually used in the code, and I find that some just aren't used at all, or at least not in other places than where they're defined, and wiretest. HSM_GHOST_COPY is a good example of it. I can't find any usage in the mainline lustre-release code, or in the drivers/staging/lustre code. Is this the sort of thing that should be flagged for deletion? Secondly, if the code boils down to: #define SOME_VAR 10 and LASSERT(SOME_VAR == 10); What's the point from a design perspective other than making it mildly more difficult to change? Thanks for any help, or insight you can give -Ben Evans From bevans at cray.com Tue Jun 9 19:48:13 2015 From: bevans at cray.com (Ben Evans) Date: Tue, 9 Jun 2015 19:48:13 +0000 Subject: [lustre-devel] wiretest.c Message-ID: <6E6D936CCB2E3C428716BD24C5C6CDF264330C@CFWEX01.americas.cray.com> I'm trying to help out with the client code merging into the kernel project. The first thing I dove into was ptlrpc, as it's a space that's been singled out as needing help. In order to get my head around it, I'm just going through the code, and one of the first things that pops up is wiretest.c, which looks to be checking that things that have been #defined have the values that they are #defined to have, that structures are offset correctly (for a given value of 'correctly') etc. So, I've started going through wiretest and seeing how much of the things that are defined are actually used in the code, and I find that some just aren't used at all, or at least not in other places than where they're defined, and wiretest. HSM_GHOST_COPY is a good example of it. I can't find any usage in the mainline lustre-release code, or in the drivers/staging/lustre code. Is this the sort of thing that should be flagged for deletion? Secondly, if the code boils down to: #define SOME_VAR 10 and LASSERT(SOME_VAR == 10); What's the point from a design perspective other than making it mildly more difficult to change? Thanks for any help, or insight you can give -Ben Evans -------------- next part -------------- An HTML attachment was scrubbed... URL: From bevans at cray.com Tue Jun 9 14:08:45 2015 From: bevans at cray.com (Ben Evans) Date: Tue, 9 Jun 2015 14:08:45 +0000 Subject: [lustre-devel] Working on client merge Message-ID: <6E6D936CCB2E3C428716BD24C5C6CDF2643227@CFWEX01.americas.cray.com> Where would be a good place to get started with helping merge the client into mainline? Thanks -Ben Evans bevans at cray.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From simmonsja at ornl.gov Wed Jun 10 17:14:09 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 10 Jun 2015 17:14:09 +0000 Subject: [lustre-devel] Working on client merge In-Reply-To: <6E6D936CCB2E3C428716BD24C5C6CDF2643227@CFWEX01.americas.cray.com> References: <6E6D936CCB2E3C428716BD24C5C6CDF2643227@CFWEX01.americas.cray.com> Message-ID: <3c566cdc50934ed6a1c5a629172da29c@EXCHCS32.ornl.gov> >Where would be a good place to get started with helping merge the client into mainline? Hi Ben Thanks for helping out for this work. I added people in the chain that have contributed a great deal to the upstream client so we can coordinate our work. Also I like to make people aware a lustre IRC channel does exist. Andreas can supply the details about the IRC channel. Currently my work has been focused on the libcfs/lnet layer. I had discuss early with Mike Shuey since he was also working in that area but will be migrating to the lustre core. Since more people are getting involved we need to find a way to break up the work to avoid duplicate work. Should the work be broken up by layer, i.e lov, mdc, or by task such as removing specific checkpatch errors with files? -------------- next part -------------- An HTML attachment was scrubbed... URL: From julia.lawall at lip6.fr Wed Jun 10 17:16:51 2015 From: julia.lawall at lip6.fr (Julia Lawall) Date: Wed, 10 Jun 2015 19:16:51 +0200 (CEST) Subject: [lustre-devel] Working on client merge In-Reply-To: <3c566cdc50934ed6a1c5a629172da29c@EXCHCS32.ornl.gov> References: <6E6D936CCB2E3C428716BD24C5C6CDF2643227@CFWEX01.americas.cray.com> <3c566cdc50934ed6a1c5a629172da29c@EXCHCS32.ornl.gov> Message-ID: On Wed, 10 Jun 2015, Simmons, James A. wrote: > > >Where would be a good place to get started with helping merge the client > into mainline? > >   > > Hi Ben > >   > >      Thanks for helping out for this work. I added people in the chain that > have contributed a great > > deal to the upstream client so we can coordinate our work. Also I like to > make people aware > > a lustre IRC channel does exist.   Andreas can supply the details about the > IRC channel. Currently > > my work has been focused on the libcfs/lnet layer. I had discuss early with > Mike Shuey  since he > > was also working in that area but will be migrating to the lustre core. > >   > >     Since more people are getting involved we need to find  a way to break > up the work to avoid > > duplicate work. Should the work be broken  up by layer, i.e lov, mdc, or by > task such as removing > > specific checkpatch errors with files? For the work I have done with Coccinelle, it is more convenient to do the whole thing. Breaking things up by layer is not helpful. This is just a data point, though. It doesn't have to imply anything about how others work on the code. julia From andreas.dilger at intel.com Wed Jun 10 17:50:55 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 10 Jun 2015 17:50:55 +0000 Subject: [lustre-devel] wiretest.c In-Reply-To: <6E6D936CCB2E3C428716BD24C5C6CDF26433AA@CFWEX01.americas.cray.com> References: <6E6D936CCB2E3C428716BD24C5C6CDF264330C@CFWEX01.americas.cray.com> <299328B7-9D13-4854-BA51-2B1F3E1D9358@intel.com>, <6E6D936CCB2E3C428716BD24C5C6CDF26433AA@CFWEX01.americas.cray.com> Message-ID: I'm happy if you are removing otherwise unused constants or structures. Cheers, Andreas > On Jun 10, 2015, at 08:01, Ben Evans wrote: > > That much I assumed from context, it just strikes me as a strange way of going about it, since it just adds a second step to change a constant. I figured code reviews would pick that stuff up pretty quickly. > > Does using it as a method of identifying unused constants make sense to you? > > -Ben > > -----Original Message----- > From: Dilger, Andreas [mailto:andreas.dilger at intel.com] > Sent: Tuesday, June 09, 2015 9:42 PM > To: Ben Evans > Cc: Drokin, Oleg; lustre-devel at lists.lustre.org > Subject: Re: wiretest.c > > Ben, > The point of wiretest.c is that these values should basically never be changed. At compile time these checks should become no-ops unless they have changed, which would be a bug. > > Cheers, Andreas > > On Jun 9, 2015, at 13:49, Ben Evans > wrote: > > I'm trying to help out with the client code merging into the kernel project. The first thing I dove into was ptlrpc, as it's a space that's been singled out as needing help. > > In order to get my head around it, I'm just going through the code, and one of the first things that pops up is wiretest.c, which looks to be checking that things that have been #defined have the values that they are #defined to have, that structures are offset correctly (for a given value of 'correctly') etc. > > So, I've started going through wiretest and seeing how much of the things that are defined are actually used in the code, and I find that some just aren't used at all, or at least not in other places than where they're defined, and wiretest. HSM_GHOST_COPY is a good example of it. I can't find any usage in the mainline lustre-release code, or in the drivers/staging/lustre code. Is this the sort of thing that should be flagged for deletion? > > Secondly, if the code boils down to: > #define SOME_VAR 10 > > and > > LASSERT(SOME_VAR == 10); > > What's the point from a design perspective other than making it mildly more difficult to change? > > Thanks for any help, or insight you can give > > -Ben Evans From paf at cray.com Wed Jun 10 17:59:30 2015 From: paf at cray.com (Patrick Farrell) Date: Wed, 10 Jun 2015 12:59:30 -0500 Subject: [lustre-devel] Working on client merge In-Reply-To: References: <6E6D936CCB2E3C428716BD24C5C6CDF2643227@CFWEX01.americas.cray.com> <3c566cdc50934ed6a1c5a629172da29c@EXCHCS32.ornl.gov> Message-ID: <55787B02.4080802@cray.com> I suggest breaking it up first by work type. As Julia noted, coccinelle/checkpatch/etc fixes (coding style, straightforward errors caught by the tools, sparse complaints, warnings, etc.) rarely require awareness of the larger flow of the design. Then there is some other types of cleanup that require more Lustre knowledge to tackle. If possible, those would be better for someone like Ben (or you, James) to work on. What do we have for that kind of work? - Patrick On 06/10/2015 12:16 PM, Julia Lawall wrote: > > On Wed, 10 Jun 2015, Simmons, James A. wrote: > >>> Where would be a good place to get started with helping merge the client >> into mainline? >> >> >> >> Hi Ben >> >> >> >> Thanks for helping out for this work. I added people in the chain that >> have contributed a great >> >> deal to the upstream client so we can coordinate our work. Also I like to >> make people aware >> >> a lustre IRC channel does exist. Andreas can supply the details about the >> IRC channel. Currently >> >> my work has been focused on the libcfs/lnet layer. I had discuss early with >> Mike Shuey since he >> >> was also working in that area but will be migrating to the lustre core. >> >> >> >> Since more people are getting involved we need to find a way to break >> up the work to avoid >> >> duplicate work. Should the work be broken up by layer, i.e lov, mdc, or by >> task such as removing >> >> specific checkpatch errors with files? > For the work I have done with Coccinelle, it is more convenient to do the > whole thing. Breaking things up by layer is not helpful. > > This is just a data point, though. It doesn't have to imply anything about > how others work on the code. > > julia > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From hannac at iu.edu Wed Jun 10 18:11:15 2015 From: hannac at iu.edu (Chris Hanna) Date: Wed, 10 Jun 2015 14:11:15 -0400 Subject: [lustre-devel] Working on client merge In-Reply-To: <55787B02.4080802@cray.com> References: <6E6D936CCB2E3C428716BD24C5C6CDF2643227@CFWEX01.americas.cray.com> <3c566cdc50934ed6a1c5a629172da29c@EXCHCS32.ornl.gov> <55787B02.4080802@cray.com> Message-ID: <55787DC3.2020901@iu.edu> I'd be happy to continue work on the format, whitespace, and coding style changes, on any areas that aren't already spoken for. Chris On 6/10/15 1:59 PM, Patrick Farrell wrote: > I suggest breaking it up first by work type. As Julia noted, > coccinelle/checkpatch/etc fixes (coding style, straightforward errors > caught by the tools, sparse complaints, warnings, etc.) rarely require > awareness of the larger flow of the design. > > Then there is some other types of cleanup that require more Lustre > knowledge to tackle. If possible, those would be better for someone > like Ben (or you, James) to work on. What do we have for that kind of > work? > > - Patrick > > On 06/10/2015 12:16 PM, Julia Lawall wrote: >> >> On Wed, 10 Jun 2015, Simmons, James A. wrote: >> >>>> Where would be a good place to get started with helping merge the >>>> client >>> into mainline? >>> >>> >>> Hi Ben >>> >>> >>> Thanks for helping out for this work. I added people in the >>> chain that >>> have contributed a great >>> >>> deal to the upstream client so we can coordinate our work. Also I >>> like to >>> make people aware >>> >>> a lustre IRC channel does exist. Andreas can supply the details >>> about the >>> IRC channel. Currently >>> >>> my work has been focused on the libcfs/lnet layer. I had discuss >>> early with >>> Mike Shuey since he >>> >>> was also working in that area but will be migrating to the lustre core. >>> >>> >>> Since more people are getting involved we need to find a way >>> to break >>> up the work to avoid >>> >>> duplicate work. Should the work be broken up by layer, i.e lov, >>> mdc, or by >>> task such as removing >>> >>> specific checkpatch errors with files? >> For the work I have done with Coccinelle, it is more convenient to do >> the >> whole thing. Breaking things up by layer is not helpful. >> >> This is just a data point, though. It doesn't have to imply anything >> about >> how others work on the code. >> >> julia >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Wed Jun 10 18:14:16 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 10 Jun 2015 11:14:16 -0700 Subject: [lustre-devel] Working on client merge In-Reply-To: <3c566cdc50934ed6a1c5a629172da29c@EXCHCS32.ornl.gov> References: <6E6D936CCB2E3C428716BD24C5C6CDF2643227@CFWEX01.americas.cray.com> <3c566cdc50934ed6a1c5a629172da29c@EXCHCS32.ornl.gov> Message-ID: <55787E78.5060004@llnl.gov> Justin Miller also made the IRC details also available here: http://wiki.lustre.org/Mailing_Lists_and_IRC Chris On 06/10/2015 10:14 AM, Simmons, James A. wrote: >>Where would be a good place to get started with helping merge the client > into mainline? > > Hi Ben > > Thanks for helping out for this work. I added people in the chain > that have contributed a great > > deal to the upstream client so we can coordinate our work. Also I like > to make people aware > > a lustre IRC channel does exist. Andreas can supply the details about > the IRC channel. Currently > > my work has been focused on the libcfs/lnet layer. I had discuss early > with Mike Shuey since he > > was also working in that area but will be migrating to the lustre core. > > Since more people are getting involved we need to find a way to > break up the work to avoid > > duplicate work. Should the work be broken up by layer, i.e lov, mdc, or > by task such as removing > > specific checkpatch errors with files? > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From jsimmons at infradead.org Thu Jun 11 19:18:06 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:06 -0400 Subject: [lustre-devel] [PATCH 0/9] staging:lustre: remove kernel defines in userland headers Message-ID: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Currently the lnet headers used for user land applications contain various kernel definations. This is due to the fact libcfs contains kernel wrappers for user land which will be going away. This patch sorted the header data so all kernel containing structures are moved out of headers that user land will use. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/13792 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger James Simmons (6): staging:lustre: Delete all obsolete LND drivers staging:lustre: move LNet NID macros to LNet layer staging:lustre: separate kernel and user land defines in the LNet headers staging:lustre: fix camel case for LNetInit and LNetFini staging:lustre: LNet header code cleanup - indentation etc staging:lustre: Update license and copyright for the LNET headers John L. Hammond (3): staging:lustre: remove lnet/include/lnet/linux/ staging:lustre: rename socklnd_lib-linux.c staging:lustre: merge socklnd_lib-linux.h into socklnd.h .../lustre/include/linux/libcfs/libcfs_ioctl.h | 2 +- .../lustre/include/linux/libcfs/libcfs_private.h | 55 -- .../lustre/include/linux/lnet/api-support.h | 44 -- drivers/staging/lustre/include/linux/lnet/api.h | 48 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 56 +- .../staging/lustre/include/linux/lnet/lib-types.h | 647 ++++++++------------ .../lustre/include/linux/lnet/linux/api-support.h | 42 -- .../lustre/include/linux/lnet/linux/lib-lnet.h | 71 --- .../lustre/include/linux/lnet/linux/lib-types.h | 45 -- .../staging/lustre/include/linux/lnet/linux/lnet.h | 56 -- .../lustre/include/linux/lnet/lnet-sysctl.h | 49 -- drivers/staging/lustre/include/linux/lnet/lnet.h | 17 +- .../staging/lustre/include/linux/lnet/lnetctl.h | 7 +- drivers/staging/lustre/include/linux/lnet/lnetst.h | 490 ++++++++------- drivers/staging/lustre/include/linux/lnet/nidstr.h | 77 +++ drivers/staging/lustre/include/linux/lnet/ptllnd.h | 93 --- .../lustre/include/linux/lnet/ptllnd_wire.h | 119 ---- .../staging/lustre/include/linux/lnet/socklnd.h | 68 +-- drivers/staging/lustre/include/linux/lnet/types.h | 290 +++++++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 5 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 1 - drivers/staging/lustre/lnet/klnds/socklnd/Makefile | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 40 ++- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.h | 86 --- .../socklnd/{socklnd_lib-linux.c => socklnd_lib.c} | 7 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 - drivers/staging/lustre/lnet/lnet/api-ni.c | 21 +- drivers/staging/lustre/lnet/lnet/config.c | 77 --- drivers/staging/lustre/lnet/lnet/module.c | 6 +- drivers/staging/lustre/lnet/lnet/router.c | 145 ----- .../lustre/lustre/include/lustre/lustre_idl.h | 1 + drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- 32 files changed, 975 insertions(+), 1698 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/lnet/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-types.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h create mode 100644 drivers/staging/lustre/include/linux/lnet/nidstr.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h delete mode 100644 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h rename drivers/staging/lustre/lnet/klnds/socklnd/{socklnd_lib-linux.c => socklnd_lib.c} (99%) From jsimmons at infradead.org Thu Jun 11 19:18:07 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:07 -0400 Subject: [lustre-devel] [PATCH v4 1/9] staging:lustre: Delete all obsolete LND drivers In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-2-git-send-email-jsimmons@infradead.org> Remove ralnd, ptllnd, mxlnd, qswlnd drivers. They are no longer supported and have not even been buildable for a long time. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6209 Reviewed-on: http://review.whamcloud.com/13663 Reviewed-by: Isaac Huang Reviewed-by: Doug Oucharek Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- .../lustre/include/linux/libcfs/libcfs_ioctl.h | 2 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 - .../staging/lustre/include/linux/lnet/lib-types.h | 4 - drivers/staging/lustre/include/linux/lnet/ptllnd.h | 93 --------------- .../lustre/include/linux/lnet/ptllnd_wire.h | 119 -------------------- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 - drivers/staging/lustre/lnet/lnet/config.c | 77 ------------- 7 files changed, 1 insertions(+), 297 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h index 3ee3878..f5d741f 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h @@ -134,7 +134,7 @@ struct libcfs_ioctl_handler { #define IOC_LIBCFS_DEL_PEER _IOWR('e', 74, long) #define IOC_LIBCFS_ADD_PEER _IOWR('e', 75, long) #define IOC_LIBCFS_GET_PEER _IOWR('e', 76, long) -#define IOC_LIBCFS_GET_TXDESC _IOWR('e', 77, long) +/* ioctl 77 is free for use */ #define IOC_LIBCFS_ADD_INTERFACE _IOWR('e', 78, long) #define IOC_LIBCFS_DEL_INTERFACE _IOWR('e', 79, long) #define IOC_LIBCFS_GET_INTERFACE _IOWR('e', 80, long) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index ac3be94..ffe88f6 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -623,7 +623,6 @@ void lnet_md_deconstruct(lnet_libmd_t *lmd, lnet_md_t *umd); void lnet_register_lnd(lnd_t *lnd); void lnet_unregister_lnd(lnd_t *lnd); -int lnet_set_ip_niaddr(lnet_ni_t *ni); int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, __u32 local_ip, __u32 peer_ip, int peer_port); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 41827a0..ad6df88 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -142,12 +142,8 @@ typedef struct { /* PROTO MAGIC for LNDs */ #define LNET_PROTO_IB_MAGIC 0x0be91b91 -#define LNET_PROTO_RA_MAGIC 0x0be91b92 -#define LNET_PROTO_QSW_MAGIC 0x0be91b93 #define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */ #define LNET_PROTO_TCP_MAGIC 0xeebc0ded -#define LNET_PROTO_PTL_MAGIC 0x50746C4E /* 'PtlN' unique magic */ -#define LNET_PROTO_MX_MAGIC 0x4d583130 /* 'MX10'! */ #define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100 #define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */ diff --git a/drivers/staging/lustre/include/linux/lnet/ptllnd.h b/drivers/staging/lustre/include/linux/lnet/ptllnd.h deleted file mode 100644 index c91d653..0000000 --- a/drivers/staging/lustre/include/linux/lnet/ptllnd.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lnet/include/lnet/ptllnd.h - * - * Author: PJ Kirner - */ - -/* - * The PTLLND was designed to support Portals with - * Lustre and non-lustre UNLINK semantics. - * However for now the two targets are Cray Portals - * on the XT3 and Lustre Portals (for testing) both - * have Lustre UNLINK semantics, so this is defined - * by default. - */ -#define LUSTRE_PORTALS_UNLINK_SEMANTICS - -#ifdef _USING_LUSTRE_PORTALS_ - -/* NIDs are 64-bits on Lustre Portals */ -#define FMT_NID "%llu" -#define FMT_PID "%d" - -/* When using Lustre Portals Lustre completion semantics are imlicit*/ -#define PTL_MD_LUSTRE_COMPLETION_SEMANTICS 0 - -#else /* _USING_CRAY_PORTALS_ */ - -/* NIDs are integers on Cray Portals */ -#define FMT_NID "%u" -#define FMT_PID "%d" - -/* When using Cray Portals this is defined in the Cray Portals Header*/ -/*#define PTL_MD_LUSTRE_COMPLETION_SEMANTICS */ - -/* Can compare handles directly on Cray Portals */ -#define PtlHandleIsEqual(a, b) ((a) == (b)) - -/* Different error types on Cray Portals*/ -#define ptl_err_t ptl_ni_fail_t - -/* - * The Cray Portals has no maximum number of IOVs. The - * maximum is limited only by memory and size of the - * int parameters (2^31-1). - * Lustre only really require that the underyling - * implementation to support at least LNET_MAX_IOV, - * so for Cray portals we can safely just use that - * value here. - * - */ -#define PTL_MD_MAX_IOV LNET_MAX_IOV - -#endif - -#define FMT_PTLID "ptlid:"FMT_PID"-"FMT_NID - -/* Align incoming small request messages to an 8 byte boundary if this is - * supported to avoid alignment issues on some architectures */ -#ifndef PTL_MD_LOCAL_ALIGN8 -# define PTL_MD_LOCAL_ALIGN8 0 -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h b/drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h deleted file mode 100644 index 808f37b..0000000 --- a/drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lnet/include/lnet/ptllnd_wire.h - * - * Author: PJ Kirner - */ - -/* Minimum buffer size that any peer will post to receive ptllnd messages */ -#define PTLLND_MIN_BUFFER_SIZE 256 - -/************************************************************************ - * Tunable defaults that {u,k}lnds/ptllnd should have in common. - */ - -#define PTLLND_PORTAL 9 /* The same portal PTLPRC used when talking to cray portals */ -#define PTLLND_PID 9 /* The Portals PID */ -#define PTLLND_PEERCREDITS 8 /* concurrent sends to 1 peer */ - -/* Default buffer size for kernel ptllnds (guaranteed eager) */ -#define PTLLND_MAX_KLND_MSG_SIZE 512 - -/* Default buffer size for catamount ptllnds (not guaranteed eager) - large - * enough to avoid RDMA for anything sent while control is not in liblustre */ -#define PTLLND_MAX_ULND_MSG_SIZE 512 - -/************************************************************************ - * Portals LND Wire message format. - * These are sent in sender's byte order (i.e. receiver flips). - */ - -#define PTL_RESERVED_MATCHBITS 0x100 /* below this value is reserved - * above is for bulk data transfer */ -#define LNET_MSG_MATCHBITS 0 /* the value for the message channel */ - -typedef struct { - lnet_hdr_t kptlim_hdr; /* portals header */ - char kptlim_payload[0]; /* piggy-backed payload */ -} WIRE_ATTR kptl_immediate_msg_t; - -typedef struct { - lnet_hdr_t kptlrm_hdr; /* portals header */ - __u64 kptlrm_matchbits; /* matchbits */ -} WIRE_ATTR kptl_rdma_msg_t; - -typedef struct { - __u64 kptlhm_matchbits; /* matchbits */ - __u32 kptlhm_max_msg_size; /* max message size */ -} WIRE_ATTR kptl_hello_msg_t; - -typedef struct { - /* First 2 fields fixed FOR ALL TIME */ - __u32 ptlm_magic; /* I'm a Portals LND message */ - __u16 ptlm_version; /* this is my version number */ - __u8 ptlm_type; /* the message type */ - __u8 ptlm_credits; /* returned credits */ - __u32 ptlm_nob; /* # bytes in whole message */ - __u32 ptlm_cksum; /* checksum (0 == no checksum) */ - __u64 ptlm_srcnid; /* sender's NID */ - __u64 ptlm_srcstamp; /* sender's incarnation */ - __u64 ptlm_dstnid; /* destination's NID */ - __u64 ptlm_dststamp; /* destination's incarnation */ - __u32 ptlm_srcpid; /* sender's PID */ - __u32 ptlm_dstpid; /* destination's PID */ - - union { - kptl_immediate_msg_t immediate; - kptl_rdma_msg_t rdma; - kptl_hello_msg_t hello; - } WIRE_ATTR ptlm_u; - -} kptl_msg_t; - -/* kptl_msg_t::ptlm_credits is only a __u8 */ -#define PTLLND_MSG_MAX_CREDITS ((typeof(((kptl_msg_t *)0)->ptlm_credits)) - 1) - -#define PTLLND_MSG_MAGIC LNET_PROTO_PTL_MAGIC -#define PTLLND_MSG_VERSION 0x04 - -#define PTLLND_RDMA_OK 0x00 -#define PTLLND_RDMA_FAIL 0x01 - -#define PTLLND_MSG_TYPE_INVALID 0x00 -#define PTLLND_MSG_TYPE_PUT 0x01 -#define PTLLND_MSG_TYPE_GET 0x02 -#define PTLLND_MSG_TYPE_IMMEDIATE 0x03 /* No bulk data xfer*/ -#define PTLLND_MSG_TYPE_NOOP 0x04 -#define PTLLND_MSG_TYPE_HELLO 0x05 -#define PTLLND_MSG_TYPE_NAK 0x06 diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index be85035..99f8396 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -243,8 +243,6 @@ lnet_accept(struct socket *sock, __u32 magic) if (magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC)) str = "'old' socknal/tcpnal"; - else if (lnet_accept_magic(magic, LNET_PROTO_RA_MAGIC)) - str = "'old' ranal"; else str = "unrecognised"; diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index efbb74a..9c576ce 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -1210,80 +1210,3 @@ lnet_parse_ip2nets(char **networksp, char *ip2nets) return 0; } - -int -lnet_set_ip_niaddr(lnet_ni_t *ni) -{ - __u32 net = LNET_NIDNET(ni->ni_nid); - char **names; - int n; - __u32 ip; - __u32 netmask; - int up; - int i; - int rc; - - /* Convenience for LNDs that use the IP address of a local interface as - * the local address part of their NID */ - - if (ni->ni_interfaces[0] != NULL) { - - CLASSERT(LNET_MAX_INTERFACES > 1); - - if (ni->ni_interfaces[1] != NULL) { - CERROR("Net %s doesn't support multiple interfaces\n", - libcfs_net2str(net)); - return -EPERM; - } - - rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask); - if (rc != 0) { - CERROR("Net %s can't query interface %s: %d\n", - libcfs_net2str(net), ni->ni_interfaces[0], rc); - return -EPERM; - } - - if (!up) { - CERROR("Net %s can't use interface %s: it's down\n", - libcfs_net2str(net), ni->ni_interfaces[0]); - return -ENETDOWN; - } - - ni->ni_nid = LNET_MKNID(net, ip); - return 0; - } - - n = lnet_ipif_enumerate(&names); - if (n <= 0) { - CERROR("Net %s can't enumerate interfaces: %d\n", - libcfs_net2str(net), n); - return 0; - } - - for (i = 0; i < n; i++) { - if (!strcmp(names[i], "lo")) /* skip the loopback IF */ - continue; - - rc = lnet_ipif_query(names[i], &up, &ip, &netmask); - if (rc != 0) { - CWARN("Net %s can't query interface %s: %d\n", - libcfs_net2str(net), names[i], rc); - continue; - } - - if (!up) { - CWARN("Net %s ignoring interface %s (down)\n", - libcfs_net2str(net), names[i]); - continue; - } - - lnet_ipif_free_enumeration(names, n); - ni->ni_nid = LNET_MKNID(net, ip); - return 0; - } - - CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net)); - lnet_ipif_free_enumeration(names, n); - return -ENOENT; -} -EXPORT_SYMBOL(lnet_set_ip_niaddr); -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:08 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:08 -0400 Subject: [lustre-devel] [PATCH v4 2/9] staging:lustre: remove lnet/include/lnet/linux/ In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-3-git-send-email-jsimmons@infradead.org> From: John L. Hammond Remove the linux specific headers from lnet/include/lnet/linux/, moving whatever was worthwhile from them to their parent headers or elsewhere. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/12932 Reviewed-by: Isaac Huang Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- .../lustre/include/linux/lnet/api-support.h | 44 ------ .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 - .../staging/lustre/include/linux/lnet/lib-types.h | 2 - .../lustre/include/linux/lnet/linux/api-support.h | 42 ------ .../lustre/include/linux/lnet/linux/lib-lnet.h | 71 ---------- .../lustre/include/linux/lnet/linux/lib-types.h | 45 ------ .../staging/lustre/include/linux/lnet/linux/lnet.h | 56 -------- .../lustre/include/linux/lnet/lnet-sysctl.h | 49 ------- drivers/staging/lustre/include/linux/lnet/lnet.h | 2 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 5 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 1 - .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 1 - .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 3 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 2 - drivers/staging/lustre/lnet/lnet/router.c | 145 -------------------- 15 files changed, 4 insertions(+), 466 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/lnet/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-types.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h diff --git a/drivers/staging/lustre/include/linux/lnet/api-support.h b/drivers/staging/lustre/include/linux/lnet/api-support.h deleted file mode 100644 index 8f7fa28..0000000 --- a/drivers/staging/lustre/include/linux/lnet/api-support.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_API_SUPPORT_H__ -#define __LNET_API_SUPPORT_H__ - -#include "linux/api-support.h" - -#include "../libcfs/libcfs.h" -#include "types.h" -#include "lnet.h" - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index ffe88f6..c46e0e6 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -41,7 +41,6 @@ #ifndef __LNET_LIB_LNET_H__ #define __LNET_LIB_LNET_H__ -#include "linux/lib-lnet.h" #include "../libcfs/libcfs.h" #include "types.h" #include "lnet.h" @@ -654,7 +653,6 @@ int lnet_sock_connect(struct socket **sockp, int *fatal, __u32 peer_ip, int peer_port); void libcfs_sock_release(struct socket *sock); -void lnet_get_tunables(void); int lnet_peers_start_down(void); int lnet_peer_buffer_credits(lnet_ni_t *ni); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index ad6df88..4b862d3 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -42,8 +42,6 @@ #ifndef __LNET_LIB_TYPES_H__ #define __LNET_LIB_TYPES_H__ -#include "linux/lib-types.h" - #include "../libcfs/libcfs.h" #include #include "types.h" diff --git a/drivers/staging/lustre/include/linux/lnet/linux/api-support.h b/drivers/staging/lustre/include/linux/lnet/linux/api-support.h deleted file mode 100644 index e237ad6..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/api-support.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LINUX_API_SUPPORT_H__ -#define __LINUX_API_SUPPORT_H__ - -#ifndef __LNET_API_SUPPORT_H__ -#error Do not #include this file directly. #include instead -#endif - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h deleted file mode 100644 index 0f8f04d..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_LINUX_LIB_LNET_H__ -#define __LNET_LINUX_LIB_LNET_H__ - -#ifndef __LNET_LIB_LNET_H__ -#error Do not #include this file directly. #include instead -#endif - -# include -# include -# include -#include "../../libcfs/libcfs.h" - -static inline __u64 -lnet_page2phys(struct page *p) -{ - /* compiler optimizer will elide unused branches */ - - switch (sizeof(typeof(page_to_phys(p)))) { - case 4: - /* page_to_phys returns a 32 bit physical address. This must - * be a 32 bit machine with <= 4G memory and we must ensure we - * don't sign extend when converting to 64 bits. */ - return (unsigned long)page_to_phys(p); - - case 8: - /* page_to_phys returns a 64 bit physical address :) */ - return page_to_phys(p); - - default: - LBUG(); - return 0; - } -} - -#define LNET_ROUTER - -#endif /* __LNET_LINUX_LIB_LNET_H__ */ diff --git a/drivers/staging/lustre/include/linux/lnet/linux/lib-types.h b/drivers/staging/lustre/include/linux/lnet/linux/lib-types.h deleted file mode 100644 index 669e8c0..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/lib-types.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_LINUX_LIB_TYPES_H__ -#define __LNET_LINUX_LIB_TYPES_H__ - -#ifndef __LNET_LIB_TYPES_H__ -#error Do not #include this file directly. #include instead -#endif - -# include -# include - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/linux/lnet.h b/drivers/staging/lustre/include/linux/lnet/linux/lnet.h deleted file mode 100644 index 1e888f1..0000000 --- a/drivers/staging/lustre/include/linux/lnet/linux/lnet.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2011, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_LINUX_LNET_H__ -#define __LNET_LINUX_LNET_H__ - -#ifndef __LNET_H__ -#error Do not #include this file directly. #include instead -#endif - -/* - * lnet.h - * - * User application interface file - */ - -#include -#include - -#define cfs_tcp_sendpage(sk, page, offset, size, flags) \ - tcp_sendpage(sk, page, offset, size, flags) - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h b/drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h deleted file mode 100644 index 2dee1b9..0000000 --- a/drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LNET_SYSCTL_H__ -#define __LNET_SYSCTL_H__ - -#if defined(CONFIG_SYSCTL) - -#define CTL_KRANAL 201 -#define CTL_O2IBLND 205 -#define CTL_PTLLND 206 -#define CTL_QSWNAL 207 -#define CTL_SOCKLND 208 -#define CTL_GNILND 210 - -#endif - -#endif diff --git a/drivers/staging/lustre/include/linux/lnet/lnet.h b/drivers/staging/lustre/include/linux/lnet/lnet.h index 75c0ab9..8d054a1 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lnet.h @@ -40,8 +40,6 @@ * * User application interface file */ -#include "linux/lnet.h" - #include "types.h" #include "api.h" diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 2a72427..48454a5 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -38,8 +38,9 @@ * Author: Eric Barton */ -#include "o2iblnd.h" #include +#include +#include "o2iblnd.h" static lnd_t the_o2iblnd = { .lnd_type = O2IBLND, @@ -1176,7 +1177,7 @@ void kiblnd_map_rx_descs(kib_conn_t *conn) CDEBUG(D_NET, "rx %d: %p %#llx(%#llx)\n", i, rx->rx_msg, rx->rx_msgaddr, - lnet_page2phys(pg) + pg_off); + (__u64)(page_to_phys(pg) + pg_off)); pg_off += IBLND_MSG_SIZE; LASSERT(pg_off <= PAGE_SIZE); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 7f52c69..f5d1d9f 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -65,7 +65,6 @@ #include "../../../include/linux/libcfs/libcfs.h" #include "../../../include/linux/lnet/lnet.h" #include "../../../include/linux/lnet/lib-lnet.h" -#include "../../../include/linux/lnet/lnet-sysctl.h" #include #include diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 06531c1..53275f9 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -34,7 +34,6 @@ #include "../../../include/linux/lnet/lnet.h" #include "../../../include/linux/lnet/lib-lnet.h" #include "../../../include/linux/lnet/socklnd.h" -#include "../../../include/linux/lnet/lnet-sysctl.h" #define SOCKNAL_PEER_HASH_SIZE 101 /* # peer lists */ #define SOCKNAL_RESCHED 100 /* # scheduler loops before reschedule */ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index 34c6a72..2b40a9f 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -146,8 +146,7 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) rc = sk->sk_prot->sendpage(sk, page, offset, fragsize, msgflg); } else { - rc = cfs_tcp_sendpage(sk, page, offset, fragsize, - msgflg); + rc = tcp_sendpage(sk, page, offset, fragsize, msgflg); } } else { #if SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_RISK_KMAP_DEADLOCK diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 9fc3bf6..a2d0d10 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1218,8 +1218,6 @@ LNetNIInit(lnet_pid_t requested_pid) goto out; } - lnet_get_tunables(); - if (requested_pid == LNET_PID_ANY) { /* Don't instantiate LNET just for me */ rc = -ENETDOWN; diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 96886a2..4fbae5e 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -24,8 +24,6 @@ #define DEBUG_SUBSYSTEM S_LNET #include "../../include/linux/lnet/lib-lnet.h" -#if defined(LNET_ROUTER) - #define LNET_NRB_TINY_MIN 512 /* min value for each CPT */ #define LNET_NRB_TINY (LNET_NRB_TINY_MIN * 4) #define LNET_NRB_SMALL_MIN 4096 /* min value for each CPT */ @@ -70,15 +68,6 @@ lnet_peer_buffer_credits(lnet_ni_t *ni) /* forward ref's */ static int lnet_router_checker(void *); -#else - -int -lnet_peer_buffer_credits(lnet_ni_t *ni) -{ - return 0; -} - -#endif static int check_routers_before_use; module_param(check_routers_before_use, int, 0444); @@ -1163,9 +1152,6 @@ lnet_prune_rc_data(int wait_unlink) lnet_net_unlock(LNET_LOCK_EX); } - -#if defined(LNET_ROUTER) - static int lnet_router_checker(void *arg) { @@ -1573,134 +1559,3 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) return 0; } EXPORT_SYMBOL(lnet_notify); - -void -lnet_get_tunables(void) -{ -} - -#else - -int -lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) -{ - return -EOPNOTSUPP; -} - -void -lnet_router_checker(void) -{ - static time_t last; - static int running; - - time_t now = get_seconds(); - int interval = now - last; - int rc; - __u64 version; - lnet_peer_t *rtr; - - /* It's no use to call me again within a sec - all intervals and - * timeouts are measured in seconds */ - if (last != 0 && interval < 2) - return; - - if (last != 0 && - interval > max(live_router_check_interval, - dead_router_check_interval)) - CNETERR("Checker(%d/%d) not called for %d seconds\n", - live_router_check_interval, dead_router_check_interval, - interval); - - LASSERT(LNET_CPT_NUMBER == 1); - - lnet_net_lock(0); - LASSERT(!running); /* recursion check */ - running = 1; - lnet_net_unlock(0); - - last = now; - - if (the_lnet.ln_rc_state == LNET_RC_STATE_STOPPING) - lnet_prune_rc_data(0); /* unlink all rcd and nowait */ - - /* consume all pending events */ - while (1) { - int i; - lnet_event_t ev; - - /* NB ln_rc_eqh must be the 1st in 'eventqs' otherwise the - * recursion breaker in LNetEQPoll would fail */ - rc = LNetEQPoll(&the_lnet.ln_rc_eqh, 1, 0, &ev, &i); - if (rc == 0) /* no event pending */ - break; - - /* NB a lost SENT prevents me from pinging a router again */ - if (rc == -EOVERFLOW) { - CERROR("Dropped an event!!!\n"); - abort(); - } - - LASSERT(rc == 1); - - lnet_router_checker_event(&ev); - } - - if (the_lnet.ln_rc_state == LNET_RC_STATE_STOPPING) { - lnet_prune_rc_data(1); /* release rcd */ - the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN; - running = 0; - return; - } - - LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); - - lnet_net_lock(0); - - version = the_lnet.ln_routers_version; - list_for_each_entry(rtr, &the_lnet.ln_routers, lp_rtr_list) { - lnet_ping_router_locked(rtr); - LASSERT(version == the_lnet.ln_routers_version); - } - - lnet_net_unlock(0); - - running = 0; /* lock only needed for the recursion check */ -} - -/* NB lnet_peers_start_down depends on me, - * so must be called before any peer creation */ -void -lnet_get_tunables(void) -{ - char *s; - - s = getenv("LNET_ROUTER_PING_TIMEOUT"); - if (s != NULL) - router_ping_timeout = atoi(s); - - s = getenv("LNET_LIVE_ROUTER_CHECK_INTERVAL"); - if (s != NULL) - live_router_check_interval = atoi(s); - - s = getenv("LNET_DEAD_ROUTER_CHECK_INTERVAL"); - if (s != NULL) - dead_router_check_interval = atoi(s); - - /* This replaces old lnd_notify mechanism */ - check_routers_before_use = 1; - if (dead_router_check_interval <= 0) - dead_router_check_interval = 30; -} - -void -lnet_rtrpools_free(void) -{ -} - -int -lnet_rtrpools_alloc(int im_a_arouter) -{ - return 0; -} - -#endif -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:10 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:10 -0400 Subject: [lustre-devel] [PATCH v4 4/9] staging:lustre: merge socklnd_lib-linux.h into socklnd.h In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-5-git-send-email-jsimmons@infradead.org> From: John L. Hammond Originally socklnd_lib-linux.h contained linux specific wrappers and defines but since the linux kernel is the only supported platform now we can merge what little remains in the header into socklnd.h. This is broken out of the original patch 12932 that was merged to the Intel/OpenSFS branch. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/12932 Reviewed-by: Isaac Huang Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 39 +++++++++- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.h | 86 -------------------- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 4 +- 3 files changed, 40 insertions(+), 89 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 53275f9..7125eb9 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -25,16 +25,40 @@ * */ +#ifndef _SOCKLND_SOCKLND_H_ +#define _SOCKLND_SOCKLND_H_ + #define DEBUG_PORTAL_ALLOC #define DEBUG_SUBSYSTEM S_LND -#include "socklnd_lib-linux.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "../../../include/linux/libcfs/libcfs.h" #include "../../../include/linux/lnet/lnet.h" #include "../../../include/linux/lnet/lib-lnet.h" #include "../../../include/linux/lnet/socklnd.h" +/* assume one thread for each connection type */ +#define SOCKNAL_NSCHEDS 3 +#define SOCKNAL_NSCHEDS_HIGH (SOCKNAL_NSCHEDS << 1) + #define SOCKNAL_PEER_HASH_SIZE 101 /* # peer lists */ #define SOCKNAL_RESCHED 100 /* # scheduler loops before reschedule */ #define SOCKNAL_INSANITY_RECONN 5000 /* connd is trying on reconn infinitely */ @@ -459,6 +483,17 @@ extern ksock_proto_t ksocknal_protocol_v3x; #define CPU_MASK_NONE 0UL #endif +static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len) +{ +#if 1 + return crc32_le(crc, p, len); +#else + while (len-- > 0) + crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ; + return crc; +#endif +} + static inline int ksocknal_route_mask(void) { @@ -651,3 +686,5 @@ extern void ksocknal_lib_csum_tx(ksock_tx_t *tx); extern int ksocknal_lib_memory_pressure(ksock_conn_t *conn); extern int ksocknal_lib_bind_thread_to_cpu(int id); + +#endif /* _SOCKLND_SOCKLND_H_ */ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h deleted file mode 100644 index f556388..0000000 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#define DEBUG_PORTAL_ALLOC - -#ifndef __LINUX_SOCKNAL_LIB_H__ -#define __LINUX_SOCKNAL_LIB_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "../../../include/linux/libcfs/libcfs.h" - -#include -static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len) -{ -#if 1 - return crc32_le(crc, p, len); -#else - while (len-- > 0) - crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ; - return crc; -#endif -} - -#define SOCKNAL_WSPACE(sk) sk_stream_wspace(sk) -#define SOCKNAL_MIN_WSPACE(sk) sk_stream_min_wspace(sk) - -/* assume one thread for each connection type */ -#define SOCKNAL_NSCHEDS 3 -#define SOCKNAL_NSCHEDS_HIGH (SOCKNAL_NSCHEDS << 1) - -#endif diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c index 2b40a9f..3407061 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c @@ -616,8 +616,8 @@ ksocknal_write_space(struct sock *sk) read_lock(&ksocknal_data.ksnd_global_lock); conn = sk->sk_user_data; - wspace = SOCKNAL_WSPACE(sk); - min_wpace = SOCKNAL_MIN_WSPACE(sk); + wspace = sk_stream_wspace(sk); + min_wpace = sk_stream_min_wspace(sk); CDEBUG(D_NET, "sk %p wspace %d low water %d conn %p%s%s%s\n", sk, wspace, min_wpace, conn, -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:14 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:14 -0400 Subject: [lustre-devel] [PATCH v4 8/9] staging:lustre: LNet header code cleanup - indentation etc In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-9-git-send-email-jsimmons@infradead.org> Handle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, alignments etc. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/api.h | 32 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 36 +- .../staging/lustre/include/linux/lnet/lib-types.h | 459 ++++++++++--------- drivers/staging/lustre/include/linux/lnet/lnetst.h | 473 +++++++++++--------- .../staging/lustre/include/linux/lnet/socklnd.h | 55 ++-- drivers/staging/lustre/include/linux/lnet/types.h | 78 ++-- 6 files changed, 595 insertions(+), 538 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index dee7f27..2eb0a05 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -95,16 +95,16 @@ void LNetSnprintHandle(char *str, int str_len, lnet_handle_any_t handle); * @{ */ int LNetMEAttach(unsigned int portal, lnet_process_id_t match_id_in, - __u64 match_bits_in, - __u64 ignore_bits_in, + __u64 match_bits_in, + __u64 ignore_bits_in, lnet_unlink_t unlink_in, lnet_ins_pos_t pos_in, lnet_handle_me_t *handle_out); int LNetMEInsert(lnet_handle_me_t current_in, lnet_process_id_t match_id_in, - __u64 match_bits_in, - __u64 ignore_bits_in, + __u64 match_bits_in, + __u64 ignore_bits_in, lnet_unlink_t unlink_in, lnet_ins_pos_t position_in, lnet_handle_me_t *handle_out); @@ -125,13 +125,13 @@ int LNetMEUnlink(lnet_handle_me_t current_in); * associated with a MD: LNetMDUnlink(). * @{ */ int LNetMDAttach(lnet_handle_me_t current_in, - lnet_md_t md_in, + lnet_md_t md_in, lnet_unlink_t unlink_in, lnet_handle_md_t *handle_out); -int LNetMDBind(lnet_md_t md_in, - lnet_unlink_t unlink_in, - lnet_handle_md_t *handle_out); +int LNetMDBind(lnet_md_t md_in, + lnet_unlink_t unlink_in, + lnet_handle_md_t *handle_out); int LNetMDUnlink(lnet_handle_md_t md_in); /** @} lnet_md */ @@ -171,10 +171,10 @@ int LNetEQWait(lnet_handle_eq_t eventq_in, lnet_event_t *event_out); int LNetEQPoll(lnet_handle_eq_t *eventqs_in, - int neq_in, - int timeout_ms, + int neq_in, + int timeout_ms, lnet_event_t *event_out, - int *which_eq_out); + int *which_eq_out); /** @} lnet_eq */ /** \defgroup lnet_data Data movement operations @@ -182,20 +182,20 @@ int LNetEQPoll(lnet_handle_eq_t *eventqs_in, * The LNet API provides two data movement operations: LNetPut() * and LNetGet(). * @{ */ -int LNetPut(lnet_nid_t self, +int LNetPut(lnet_nid_t self, lnet_handle_md_t md_in, lnet_ack_req_t ack_req_in, lnet_process_id_t target_in, unsigned int portal_in, - __u64 match_bits_in, + __u64 match_bits_in, unsigned int offset_in, - __u64 hdr_data_in); + __u64 hdr_data_in); -int LNetGet(lnet_nid_t self, +int LNetGet(lnet_nid_t self, lnet_handle_md_t md_in, lnet_process_id_t target_in, unsigned int portal_in, - __u64 match_bits_in, + __u64 match_bits_in, unsigned int offset_in); /** @} lnet_data */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 6246e2e..0dbab6f 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -44,29 +44,29 @@ #include "lnet.h" #include "lib-types.h" -extern lnet_t the_lnet; /* THE network */ +extern lnet_t the_lnet; /* THE network */ #if (BITS_PER_LONG == 32) /* 2 CPTs, allowing more CPTs might make us under memory pressure */ -# define LNET_CPT_MAX_BITS 1 +#define LNET_CPT_MAX_BITS 1 #else /* 64-bit system */ /* * 256 CPTs for thousands of CPUs, allowing more CPTs might make us * under risk of consuming all lh_cookie. */ -# define LNET_CPT_MAX_BITS 8 +#define LNET_CPT_MAX_BITS 8 #endif /* BITS_PER_LONG == 32 */ /* max allowed CPT number */ -#define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS) +#define LNET_CPT_MAX (1 << LNET_CPT_MAX_BITS) -#define LNET_CPT_NUMBER (the_lnet.ln_cpt_number) -#define LNET_CPT_BITS (the_lnet.ln_cpt_bits) -#define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1) +#define LNET_CPT_NUMBER (the_lnet.ln_cpt_number) +#define LNET_CPT_BITS (the_lnet.ln_cpt_bits) +#define LNET_CPT_MASK ((1ULL << LNET_CPT_BITS) - 1) /** exclusive lock */ -#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX +#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX static inline int lnet_is_wire_handle_none(lnet_handle_wire_t *wh) { @@ -163,7 +163,7 @@ lnet_net_lock_current(void) #define lnet_ni_lock(ni) spin_lock(&(ni)->ni_lock) #define lnet_ni_unlock(ni) spin_unlock(&(ni)->ni_lock) -#define MAX_PORTALS 64 +#define MAX_PORTALS 64 static inline lnet_eq_t * lnet_eq_alloc(void) @@ -184,8 +184,8 @@ static inline lnet_libmd_t * lnet_md_alloc(lnet_md_t *umd) { lnet_libmd_t *md; - unsigned int size; - unsigned int niov; + unsigned int size; + unsigned int niov; if ((umd->options & LNET_MD_KIOV) != 0) { niov = umd->length; @@ -211,7 +211,7 @@ lnet_md_alloc(lnet_md_t *umd) static inline void lnet_md_free(lnet_libmd_t *md) { - unsigned int size; + unsigned int size; if ((md->md_options & LNET_MD_KIOV) != 0) size = offsetof(lnet_libmd_t, md_iov.kiov[md->md_niov]); @@ -299,7 +299,7 @@ lnet_handle2md(lnet_handle_md_t *handle) { /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; - int cpt; + int cpt; cpt = lnet_cpt_of_cookie(handle->cookie); lh = lnet_res_lh_lookup(the_lnet.ln_md_containers[cpt], @@ -315,7 +315,7 @@ lnet_wire_handle2md(lnet_handle_wire_t *wh) { /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; - int cpt; + int cpt; if (wh->wh_interface_cookie != the_lnet.ln_interface_cookie) return NULL; @@ -340,7 +340,7 @@ lnet_handle2me(lnet_handle_me_t *handle) { /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; - int cpt; + int cpt; cpt = lnet_cpt_of_cookie(handle->cookie); lh = lnet_res_lh_lookup(the_lnet.ln_me_containers[cpt], @@ -530,7 +530,9 @@ void lnet_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, unsigned int offset, unsigned int mlen, unsigned int rlen); lnet_msg_t *lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *get_msg); void lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *msg, unsigned int len); + void lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int rc); + void lnet_drop_delayed_msg_list(struct list_head *head, char *reason); void lnet_recv_delayed_msg_list(struct list_head *head); @@ -679,12 +681,12 @@ void lnet_peer_tables_destroy(void); int lnet_peer_tables_create(void); void lnet_debug_peer(lnet_nid_t nid); -static inline void lnet_peer_set_alive(lnet_peer_t *lp) +static inline void +lnet_peer_set_alive(lnet_peer_t *lp) { lp->lp_last_alive = lp->lp_last_query = get_seconds(); if (!lp->lp_alive) lnet_notify_locked(lp, 0, 1, lp->lp_last_alive); } - #endif diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 8e8e725..fa949d8 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -54,17 +54,17 @@ #if (LNET_MAX_PAYLOAD < LNET_MTU) # error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb" #elif (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV)) -# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" +# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" #endif /* forward refs */ struct lnet_libmd; typedef struct lnet_msg { - struct list_head msg_activelist; - struct list_head msg_list; /* Q for credits/MD */ + struct list_head msg_activelist; + struct list_head msg_list; /* Q for credits/MD */ - lnet_process_id_t msg_target; + lnet_process_id_t msg_target; /* where is it from, it's only for building event */ lnet_nid_t msg_from; __u32 msg_type; @@ -84,110 +84,111 @@ typedef struct lnet_msg { /* ready for pending on RX delay list */ unsigned int msg_rx_ready_delay:1; - unsigned int msg_vmflush:1; /* VM trying to free memory */ - unsigned int msg_target_is_router:1; /* sending to a router */ - unsigned int msg_routing:1; /* being forwarded */ - unsigned int msg_ack:1; /* ack on finalize (PUT) */ - unsigned int msg_sending:1; /* outgoing message */ - unsigned int msg_receiving:1; /* being received */ - unsigned int msg_txcredit:1; /* taken an NI send credit */ - unsigned int msg_peertxcredit:1; /* taken a peer send credit */ - unsigned int msg_rtrcredit:1; /* taken a global router credit */ - unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ - unsigned int msg_onactivelist:1; /* on the activelist */ - - struct lnet_peer *msg_txpeer; /* peer I'm sending to */ - struct lnet_peer *msg_rxpeer; /* peer I received from */ - - void *msg_private; - struct lnet_libmd *msg_md; - - unsigned int msg_len; - unsigned int msg_wanted; - unsigned int msg_offset; - unsigned int msg_niov; - struct kvec *msg_iov; - lnet_kiov_t *msg_kiov; - - lnet_event_t msg_ev; - lnet_hdr_t msg_hdr; + unsigned int msg_vmflush:1; /* VM trying to free memory */ + unsigned int msg_target_is_router:1; /* sending to a router */ + unsigned int msg_routing:1; /* being forwarded */ + unsigned int msg_ack:1; /* ack on finalize (PUT) */ + unsigned int msg_sending:1; /* outgoing message */ + unsigned int msg_receiving:1; /* being received */ + unsigned int msg_txcredit:1; /* taken an NI send credit */ + unsigned int msg_peertxcredit:1; /* taken a peer send credit */ + unsigned int msg_rtrcredit:1; /* taken a global + router credit */ + unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ + unsigned int msg_onactivelist:1; /* on the activelist */ + + struct lnet_peer *msg_txpeer; /* peer I'm sending to */ + struct lnet_peer *msg_rxpeer; /* peer I received from */ + + void *msg_private; + struct lnet_libmd *msg_md; + + unsigned int msg_len; + unsigned int msg_wanted; + unsigned int msg_offset; + unsigned int msg_niov; + struct kvec *msg_iov; + lnet_kiov_t *msg_kiov; + + lnet_event_t msg_ev; + lnet_hdr_t msg_hdr; } lnet_msg_t; typedef struct lnet_libhandle { - struct list_head lh_hash_chain; - __u64 lh_cookie; + struct list_head lh_hash_chain; + __u64 lh_cookie; } lnet_libhandle_t; #define lh_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(char *)(&((type *)0)->member))) typedef struct lnet_eq { - struct list_head eq_list; - lnet_libhandle_t eq_lh; - lnet_seq_t eq_enq_seq; - lnet_seq_t eq_deq_seq; - unsigned int eq_size; - lnet_eq_handler_t eq_callback; - lnet_event_t *eq_events; + struct list_head eq_list; + lnet_libhandle_t eq_lh; + lnet_seq_t eq_enq_seq; + lnet_seq_t eq_deq_seq; + unsigned int eq_size; + lnet_eq_handler_t eq_callback; + lnet_event_t *eq_events; int **eq_refs; /* percpt refcount for EQ */ } lnet_eq_t; typedef struct lnet_me { - struct list_head me_list; - lnet_libhandle_t me_lh; - lnet_process_id_t me_match_id; - unsigned int me_portal; - unsigned int me_pos; /* hash offset in mt_hash */ - __u64 me_match_bits; - __u64 me_ignore_bits; - lnet_unlink_t me_unlink; - struct lnet_libmd *me_md; + struct list_head me_list; + lnet_libhandle_t me_lh; + lnet_process_id_t me_match_id; + unsigned int me_portal; + unsigned int me_pos; /* hash offset in mt_hash */ + __u64 me_match_bits; + __u64 me_ignore_bits; + lnet_unlink_t me_unlink; + struct lnet_libmd *me_md; } lnet_me_t; typedef struct lnet_libmd { - struct list_head md_list; - lnet_libhandle_t md_lh; - lnet_me_t *md_me; - char *md_start; - unsigned int md_offset; - unsigned int md_length; - unsigned int md_max_size; - int md_threshold; - int md_refcount; - unsigned int md_options; - unsigned int md_flags; - void *md_user_ptr; - lnet_eq_t *md_eq; - unsigned int md_niov; /* # frags */ + struct list_head md_list; + lnet_libhandle_t md_lh; + lnet_me_t *md_me; + char *md_start; + unsigned int md_offset; + unsigned int md_length; + unsigned int md_max_size; + int md_threshold; + int md_refcount; + unsigned int md_options; + unsigned int md_flags; + void *md_user_ptr; + lnet_eq_t *md_eq; + unsigned int md_niov; /* # frags */ union { - struct kvec iov[LNET_MAX_IOV]; - lnet_kiov_t kiov[LNET_MAX_IOV]; + struct kvec iov[LNET_MAX_IOV]; + lnet_kiov_t kiov[LNET_MAX_IOV]; } md_iov; } lnet_libmd_t; -#define LNET_MD_FLAG_ZOMBIE (1 << 0) -#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) -#define LNET_MD_FLAG_ABORTED (1 << 2) +#define LNET_MD_FLAG_ZOMBIE (1 << 0) +#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1) +#define LNET_MD_FLAG_ABORTED (1 << 2) typedef struct { /* info about peers we are trying to fail */ - struct list_head tp_list; /* ln_test_peers */ - lnet_nid_t tp_nid; /* matching nid */ - unsigned int tp_threshold; /* # failures to simulate */ + struct list_head tp_list; /* ln_test_peers */ + lnet_nid_t tp_nid; /* matching nid */ + unsigned int tp_threshold; /* # failures to simulate */ } lnet_test_peer_t; -#define LNET_COOKIE_TYPE_MD 1 -#define LNET_COOKIE_TYPE_ME 2 -#define LNET_COOKIE_TYPE_EQ 3 -#define LNET_COOKIE_TYPE_BITS 2 +#define LNET_COOKIE_TYPE_MD 1 +#define LNET_COOKIE_TYPE_ME 2 +#define LNET_COOKIE_TYPE_EQ 3 +#define LNET_COOKIE_TYPE_BITS 2 #define LNET_COOKIE_MASK ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL) -struct lnet_ni; /* forward ref */ +struct lnet_ni; /* forward ref */ typedef struct lnet_lnd { /* fields managed by portals */ - struct list_head lnd_list; /* stash in the LND table */ - int lnd_refcount; /* # active instances */ + struct list_head lnd_list; /* stash in the LND table */ + int lnd_refcount; /* # active instances */ /* fields initialised by the LND */ __u32 lnd_type; @@ -222,7 +223,8 @@ typedef struct lnet_lnd { int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, - unsigned int offset, unsigned int mlen, unsigned int rlen); + unsigned int offset, unsigned int mlen, + unsigned int rlen); /* lnet_parse() has had to delay processing of this message * (e.g. waiting for a forwarding buffer or send credits). Give the @@ -230,49 +232,49 @@ typedef struct lnet_lnd { * for success and do NOT give back a receive credit; that has to wait * until lnd_recv() gets called. On failure return < 0 and * release resources; lnd_recv() will not be called. */ - int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, - void **new_privatep); + int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, + lnet_msg_t *msg, void **new_privatep); /* notification of peer health */ void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive); /* query of peer aliveness */ - void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer, unsigned long *when); + void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer, + unsigned long *when); /* accept a new connection */ int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock); - } lnd_t; struct lnet_tx_queue { int tq_credits; /* # tx credits free */ int tq_credits_min; /* lowest it's been */ int tq_credits_max; /* total # tx credits */ - struct list_head tq_delayed; /* delayed TXs */ + struct list_head tq_delayed; /* delayed TXs */ }; typedef struct lnet_ni { - spinlock_t ni_lock; - struct list_head ni_list; /* chain on ln_nis */ - struct list_head ni_cptlist; /* chain on ln_nis_cpt */ - int ni_maxtxcredits; /* # tx credits */ + spinlock_t ni_lock; + struct list_head ni_list; /* chain on ln_nis */ + struct list_head ni_cptlist; /* chain on ln_nis_cpt */ + int ni_maxtxcredits; /* # tx credits */ /* # per-peer send credits */ - int ni_peertxcredits; + int ni_peertxcredits; /* # per-peer router buffer credits */ - int ni_peerrtrcredits; + int ni_peerrtrcredits; /* seconds to consider peer dead */ - int ni_peertimeout; - int ni_ncpts; /* number of CPTs */ - __u32 *ni_cpts; /* bond NI on some CPTs */ - lnet_nid_t ni_nid; /* interface's NID */ - void *ni_data; /* instance-specific data */ - lnd_t *ni_lnd; /* procedural interface */ + int ni_peertimeout; + int ni_ncpts; /* number of CPTs */ + __u32 *ni_cpts; /* bond NI on some CPTs */ + lnet_nid_t ni_nid; /* interface's NID */ + void *ni_data; /* instance-specific data */ + lnd_t *ni_lnd; /* procedural interface */ struct lnet_tx_queue **ni_tx_queues; /* percpt TX queues */ int **ni_refs; /* percpt reference count */ - long ni_last_alive; /* when I was last alive */ - lnet_ni_status_t *ni_status; /* my health status */ + long ni_last_alive;/* when I was last alive */ + lnet_ni_status_t *ni_status; /* my health status */ /* equivalent interfaces to use */ - char *ni_interfaces[LNET_MAX_INTERFACES]; + char *ni_interfaces[LNET_MAX_INTERFACES]; } lnet_ni_t; #define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL @@ -291,55 +293,65 @@ typedef struct lnet_ni { #define LNET_PINGINFO_SIZE offsetof(lnet_ping_info_t, pi_ni[LNET_MAX_RTR_NIS]) typedef struct { /* chain on the_lnet.ln_zombie_rcd or ln_deathrow_rcd */ - struct list_head rcd_list; - lnet_handle_md_t rcd_mdh; /* ping buffer MD */ + struct list_head rcd_list; + lnet_handle_md_t rcd_mdh; /* ping buffer MD */ struct lnet_peer *rcd_gateway; /* reference to gateway */ lnet_ping_info_t *rcd_pinginfo; /* ping buffer */ } lnet_rc_data_t; typedef struct lnet_peer { - struct list_head lp_hashlist; /* chain on peer hash */ - struct list_head lp_txq; /* messages blocking for tx credits */ - struct list_head lp_rtrq; /* messages blocking for router credits */ - struct list_head lp_rtr_list; /* chain on router list */ - int lp_txcredits; /* # tx credits available */ - int lp_mintxcredits; /* low water mark */ - int lp_rtrcredits; /* # router credits */ - int lp_minrtrcredits; /* low water mark */ - unsigned int lp_alive:1; /* alive/dead? */ - unsigned int lp_notify:1; /* notification outstanding? */ - unsigned int lp_notifylnd:1; /* outstanding notification for LND? */ - unsigned int lp_notifying:1; /* some thread is handling notification */ - unsigned int lp_ping_notsent; /* SEND event outstanding from ping */ - int lp_alive_count; /* # times router went dead<->alive */ - long lp_txqnob; /* bytes queued for sending */ - unsigned long lp_timestamp; /* time of last aliveness news */ - unsigned long lp_ping_timestamp; /* time of last ping attempt */ - unsigned long lp_ping_deadline; /* != 0 if ping reply expected */ - unsigned long lp_last_alive; /* when I was last alive */ - unsigned long lp_last_query; /* when lp_ni was queried last time */ - lnet_ni_t *lp_ni; /* interface peer is on */ - lnet_nid_t lp_nid; /* peer's NID */ - int lp_refcount; /* # refs */ - int lp_cpt; /* CPT this peer attached on */ + struct list_head lp_hashlist; /* chain on peer hash */ + struct list_head lp_txq; /* messages blocking for + tx credits */ + struct list_head lp_rtrq; /* messages blocking for + router credits */ + struct list_head lp_rtr_list; /* chain on router list */ + int lp_txcredits; /* # tx credits available */ + int lp_mintxcredits; /* low water mark */ + int lp_rtrcredits; /* # router credits */ + int lp_minrtrcredits; /* low water mark */ + unsigned int lp_alive:1; /* alive/dead? */ + unsigned int lp_notify:1; /* notification outstanding? */ + unsigned int lp_notifylnd:1;/* outstanding notification + for LND? */ + unsigned int lp_notifying:1; /* some thread is handling + notification */ + unsigned int lp_ping_notsent;/* SEND event outstanding + from ping */ + int lp_alive_count; /* # times router went + dead<->alive */ + long lp_txqnob; /* bytes queued for sending */ + unsigned long lp_timestamp; /* time of last aliveness + news */ + unsigned long lp_ping_timestamp;/* time of last ping + attempt */ + unsigned long lp_ping_deadline; /* != 0 if ping reply + expected */ + unsigned long lp_last_alive; /* when I was last alive */ + unsigned long lp_last_query; /* when lp_ni was queried + last time */ + lnet_ni_t *lp_ni; /* interface peer is on */ + lnet_nid_t lp_nid; /* peer's NID */ + int lp_refcount; /* # refs */ + int lp_cpt; /* CPT this peer attached on */ /* # refs from lnet_route_t::lr_gateway */ - int lp_rtr_refcount; + int lp_rtr_refcount; /* returned RC ping features */ - unsigned int lp_ping_feats; - struct list_head lp_routes; /* routers on this peer */ + unsigned int lp_ping_feats; + struct list_head lp_routes; /* routers on this peer */ lnet_rc_data_t *lp_rcd; /* router checker state */ } lnet_peer_t; /* peer hash size */ -#define LNET_PEER_HASH_BITS 9 -#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS) +#define LNET_PEER_HASH_BITS 9 +#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS) /* peer hash table */ struct lnet_peer_table { - int pt_version; /* /proc validity stamp */ - int pt_number; /* # peers extant */ - struct list_head pt_deathrow; /* zombie peers */ - struct list_head *pt_hash; /* NID->peer hash */ + int pt_version; /* /proc validity stamp */ + int pt_number; /* # peers extant */ + struct list_head pt_deathrow; /* zombie peers */ + struct list_head *pt_hash; /* NID->peer hash */ }; /* peer aliveness is enabled only on routers for peers in a network where the @@ -348,14 +360,14 @@ struct lnet_peer_table { (lp)->lp_ni->ni_peertimeout > 0) typedef struct { - struct list_head lr_list; /* chain on net */ - struct list_head lr_gwlist; /* chain on gateway */ + struct list_head lr_list; /* chain on net */ + struct list_head lr_gwlist; /* chain on gateway */ lnet_peer_t *lr_gateway; /* router node */ - __u32 lr_net; /* remote network number */ - int lr_seq; /* sequence for round-robin */ - unsigned int lr_downis; /* number of down NIs */ - unsigned int lr_hops; /* how far I am */ - unsigned int lr_priority; /* route priority */ + __u32 lr_net; /* remote network number */ + int lr_seq; /* sequence for round-robin */ + unsigned int lr_downis; /* number of down NIs */ + unsigned int lr_hops; /* how far I am */ + unsigned int lr_priority; /* route priority */ } lnet_route_t; #define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7) @@ -363,9 +375,10 @@ typedef struct { #define LNET_REMOTE_NETS_HASH_SIZE (1 << the_lnet.ln_remote_nets_hbits) typedef struct { - struct list_head lrn_list; /* chain on ln_remote_nets_hash */ - struct list_head lrn_routes; /* routes to me */ - __u32 lrn_net; /* my net number */ + struct list_head lrn_list; /* chain on + ln_remote_nets_hash */ + struct list_head lrn_routes; /* routes to me */ + __u32 lrn_net; /* my net number */ } lnet_remotenet_t; /** lnet message has credit and can be submitted to lnd for send/receive */ @@ -374,21 +387,23 @@ typedef struct { #define LNET_CREDIT_WAIT 1 typedef struct { - struct list_head rbp_bufs; /* my free buffer pool */ - struct list_head rbp_msgs; /* messages blocking for a buffer */ - int rbp_npages; /* # pages in each buffer */ - int rbp_nbuffers; /* # buffers */ - int rbp_credits; /* # free buffers / blocked messages */ - int rbp_mincredits; /* low water mark */ + struct list_head rbp_bufs; /* my free buffer pool */ + struct list_head rbp_msgs; /* messages blocking + for a buffer */ + int rbp_npages; /* # pages in each buffer */ + int rbp_nbuffers; /* # buffers */ + int rbp_credits; /* # free buffers / + blocked messages */ + int rbp_mincredits; /* low water mark */ } lnet_rtrbufpool_t; typedef struct { - struct list_head rb_list; /* chain on rbp_bufs */ - lnet_rtrbufpool_t *rb_pool; /* owning pool */ - lnet_kiov_t rb_kiov[0]; /* the buffer space */ + struct list_head rb_list; /* chain on rbp_bufs */ + lnet_rtrbufpool_t *rb_pool; /* owning pool */ + lnet_kiov_t rb_kiov[0]; /* the buffer space */ } lnet_rtrbuf_t; -#define LNET_PEER_HASHSIZE 503 /* prime! */ +#define LNET_PEER_HASHSIZE 503 /* prime! */ #define LNET_NRBPOOLS 3 /* # different router buffer pools */ @@ -400,15 +415,16 @@ enum { /* Must be discarded */ LNET_MATCHMD_DROP = (1 << 2), /* match and buffer is exhausted */ - LNET_MATCHMD_EXHAUSTED = (1 << 3), + LNET_MATCHMD_EXHAUSTED = (1 << 3), /* match or drop */ - LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP), + LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP), }; /* Options for lnet_portal_t::ptl_options */ -#define LNET_PTL_LAZY (1 << 0) -#define LNET_PTL_MATCH_UNIQUE (1 << 1) /* unique match, for RDMA */ -#define LNET_PTL_MATCH_WILDCARD (1 << 2) /* wildcard match, request portal */ +#define LNET_PTL_LAZY (1 << 0) +#define LNET_PTL_MATCH_UNIQUE (1 << 1) /* unique match, for RDMA */ +#define LNET_PTL_MATCH_WILDCARD (1 << 2) /* wildcard match, + request portal */ /* parameter for matching operations (GET, PUT) */ struct lnet_match_info { @@ -437,14 +453,14 @@ struct lnet_match_info { /* portal match table */ struct lnet_match_table { /* reserved for upcoming patches, CPU partition ID */ - unsigned int mt_cpt; - unsigned int mt_portal; /* portal index */ + unsigned int mt_cpt; + unsigned int mt_portal; /* portal index */ /* match table is set as "enabled" if there's non-exhausted MD * attached on mt_mhash, it's only valid for wildcard portal */ - unsigned int mt_enabled; + unsigned int mt_enabled; /* bitmap to flag whether MEs on mt_hash are exhausted or not */ - __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP]; - struct list_head *mt_mhash; /* matching hash */ + __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP]; + struct list_head *mt_mhash; /* matching hash */ }; /* these are only useful for wildcard portal */ @@ -458,22 +474,22 @@ struct lnet_match_table { #define LNET_PTL_ROTOR_HASH_RT 3 typedef struct lnet_portal { - spinlock_t ptl_lock; - unsigned int ptl_index; /* portal ID, reserved */ + spinlock_t ptl_lock; + unsigned int ptl_index; /* portal ID, reserved */ /* flags on this portal: lazy, unique... */ - unsigned int ptl_options; + unsigned int ptl_options; /* list of messages which are stealing buffer */ - struct list_head ptl_msg_stealing; + struct list_head ptl_msg_stealing; /* messages blocking for MD */ - struct list_head ptl_msg_delayed; + struct list_head ptl_msg_delayed; /* Match table for each CPT */ struct lnet_match_table **ptl_mtables; /* spread rotor of incoming "PUT" */ - unsigned int ptl_rotor; + unsigned int ptl_rotor; /* # active entries for this portal */ - int ptl_mt_nmaps; + int ptl_mt_nmaps; /* array of active entries' cpu-partition-id */ - int ptl_mt_maps[0]; + int ptl_mt_maps[0]; } lnet_portal_t; #define LNET_LH_HASH_BITS 12 @@ -482,20 +498,20 @@ typedef struct lnet_portal { /* resource container (ME, MD, EQ) */ struct lnet_res_container { - unsigned int rec_type; /* container type */ - __u64 rec_lh_cookie; /* cookie generator */ - struct list_head rec_active; /* active resource list */ - struct list_head *rec_lh_hash; /* handle hash */ + unsigned int rec_type; /* container type */ + __u64 rec_lh_cookie; /* cookie generator */ + struct list_head rec_active; /* active resource list */ + struct list_head *rec_lh_hash; /* handle hash */ }; /* message container */ struct lnet_msg_container { - int msc_init; /* initialized or not */ + int msc_init; /* initialized or not */ /* max # threads finalizing */ - int msc_nfinalizers; + int msc_nfinalizers; /* msgs waiting to complete finalizing */ - struct list_head msc_finalizing; - struct list_head msc_active; /* active message list */ + struct list_head msc_finalizing; + struct list_head msc_active; /* active message list */ /* threads doing finalization */ void **msc_finalizers; }; @@ -507,15 +523,15 @@ struct lnet_msg_container { typedef struct { /* CPU partition table of LNet */ - struct cfs_cpt_table *ln_cpt_table; + struct cfs_cpt_table *ln_cpt_table; /* number of CPTs in ln_cpt_table */ - unsigned int ln_cpt_number; - unsigned int ln_cpt_bits; + unsigned int ln_cpt_number; + unsigned int ln_cpt_bits; /* protect LNet resources (ME/MD/EQ) */ - struct cfs_percpt_lock *ln_res_lock; + struct cfs_percpt_lock *ln_res_lock; /* # portals */ - int ln_nportals; + int ln_nportals; /* the vector of portals */ lnet_portal_t **ln_portals; /* percpt ME containers */ @@ -524,77 +540,78 @@ typedef struct { struct lnet_res_container **ln_md_containers; /* Event Queue container */ - struct lnet_res_container ln_eq_container; - wait_queue_head_t ln_eq_waitq; - spinlock_t ln_eq_wait_lock; - unsigned int ln_remote_nets_hbits; + struct lnet_res_container ln_eq_container; + wait_queue_head_t ln_eq_waitq; + spinlock_t ln_eq_wait_lock; + unsigned int ln_remote_nets_hbits; /* protect NI, peer table, credits, routers, rtrbuf... */ - struct cfs_percpt_lock *ln_net_lock; + struct cfs_percpt_lock *ln_net_lock; /* percpt message containers for active/finalizing/freed message */ struct lnet_msg_container **ln_msg_containers; lnet_counters_t **ln_counters; struct lnet_peer_table **ln_peer_tables; /* failure simulation */ - struct list_head ln_test_peers; + struct list_head ln_test_peers; - struct list_head ln_nis; /* LND instances */ + struct list_head ln_nis; /* LND instances */ /* NIs bond on specific CPT(s) */ - struct list_head ln_nis_cpt; + struct list_head ln_nis_cpt; /* dying LND instances */ - struct list_head ln_nis_zombie; - lnet_ni_t *ln_loni; /* the loopback NI */ + struct list_head ln_nis_zombie; + lnet_ni_t *ln_loni; /* the loopback NI */ /* NI to wait for events in */ - lnet_ni_t *ln_eq_waitni; + lnet_ni_t *ln_eq_waitni; /* remote networks with routes to them */ - struct list_head *ln_remote_nets_hash; + struct list_head *ln_remote_nets_hash; /* validity stamp */ - __u64 ln_remote_nets_version; + __u64 ln_remote_nets_version; /* list of all known routers */ - struct list_head ln_routers; + struct list_head ln_routers; /* validity stamp */ - __u64 ln_routers_version; + __u64 ln_routers_version; /* percpt router buffer pools */ lnet_rtrbufpool_t **ln_rtrpools; - lnet_handle_md_t ln_ping_target_md; - lnet_handle_eq_t ln_ping_target_eq; - lnet_ping_info_t *ln_ping_info; + lnet_handle_md_t ln_ping_target_md; + lnet_handle_eq_t ln_ping_target_eq; + lnet_ping_info_t *ln_ping_info; /* router checker startup/shutdown state */ - int ln_rc_state; + int ln_rc_state; /* router checker's event queue */ - lnet_handle_eq_t ln_rc_eqh; + lnet_handle_eq_t ln_rc_eqh; /* rcd still pending on net */ - struct list_head ln_rcd_deathrow; + struct list_head ln_rcd_deathrow; /* rcd ready for free */ - struct list_head ln_rcd_zombie; + struct list_head ln_rcd_zombie; /* serialise startup/shutdown */ - struct semaphore ln_rc_signal; + struct semaphore ln_rc_signal; - struct mutex ln_api_mutex; - struct mutex ln_lnd_mutex; - int ln_init; /* lnet_init() called? */ + struct mutex ln_api_mutex; + struct mutex ln_lnd_mutex; + int ln_init; /* lnet_init() + called? */ /* Have I called LNetNIInit myself? */ - int ln_niinit_self; + int ln_niinit_self; /* LNetNIInit/LNetNIFini counter */ - int ln_refcount; + int ln_refcount; /* shutdown in progress */ - int ln_shutdown; + int ln_shutdown; - int ln_routing; /* am I a router? */ - lnet_pid_t ln_pid; /* requested pid */ + int ln_routing; /* am I a router? */ + lnet_pid_t ln_pid; /* requested pid */ /* uniquely identifies this ni in this epoch */ - __u64 ln_interface_cookie; + __u64 ln_interface_cookie; /* registered LNDs */ - struct list_head ln_lnds; + struct list_head ln_lnds; /* space for network names */ - char *ln_network_tokens; - int ln_network_tokens_nob; + char *ln_network_tokens; + int ln_network_tokens_nob; /* test protocol compatibility flags */ - int ln_testprotocompat; + int ln_testprotocompat; } lnet_t; diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 57432fd..ea1e0c6 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -49,99 +49,107 @@ #define LST_FEATS_EMPTY (LST_FEAT_NONE) #define LST_FEATS_MASK (LST_FEAT_NONE | LST_FEAT_BULK_LEN) -#define LST_NAME_SIZE 32 /* max name buffer length */ - -#define LSTIO_DEBUG 0xC00 /* debug */ -#define LSTIO_SESSION_NEW 0xC01 /* create session */ -#define LSTIO_SESSION_END 0xC02 /* end session */ -#define LSTIO_SESSION_INFO 0xC03 /* query session */ -#define LSTIO_GROUP_ADD 0xC10 /* add group */ -#define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */ -#define LSTIO_GROUP_INFO 0xC12 /* query default information of specified group */ -#define LSTIO_GROUP_DEL 0xC13 /* delete group */ -#define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */ -#define LSTIO_GROUP_UPDATE 0xC15 /* update group */ -#define LSTIO_BATCH_ADD 0xC20 /* add batch */ -#define LSTIO_BATCH_START 0xC21 /* start batch */ -#define LSTIO_BATCH_STOP 0xC22 /* stop batch */ -#define LSTIO_BATCH_DEL 0xC23 /* delete batch */ -#define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */ -#define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */ -#define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */ -#define LSTIO_BATCH_QUERY 0xC27 /* query batch status */ -#define LSTIO_STAT_QUERY 0xC30 /* get stats */ - -typedef struct { - lnet_nid_t ses_nid; /* nid of console node */ - __u64 ses_stamp; /* time stamp */ -} lst_sid_t; /*** session id */ +#define LST_NAME_SIZE 32 /* max name buffer length */ + +#define LSTIO_DEBUG 0xC00 /* debug */ +#define LSTIO_SESSION_NEW 0xC01 /* create session */ +#define LSTIO_SESSION_END 0xC02 /* end session */ +#define LSTIO_SESSION_INFO 0xC03 /* query session */ +#define LSTIO_GROUP_ADD 0xC10 /* add group */ +#define LSTIO_GROUP_LIST 0xC11 /* list all groups in session */ +#define LSTIO_GROUP_INFO 0xC12 /* query default information of + * specified group */ +#define LSTIO_GROUP_DEL 0xC13 /* delete group */ +#define LSTIO_NODES_ADD 0xC14 /* add nodes to specified group */ +#define LSTIO_GROUP_UPDATE 0xC15 /* update group */ +#define LSTIO_BATCH_ADD 0xC20 /* add batch */ +#define LSTIO_BATCH_START 0xC21 /* start batch */ +#define LSTIO_BATCH_STOP 0xC22 /* stop batch */ +#define LSTIO_BATCH_DEL 0xC23 /* delete batch */ +#define LSTIO_BATCH_LIST 0xC24 /* show all batches in the session */ +#define LSTIO_BATCH_INFO 0xC25 /* show defail of specified batch */ +#define LSTIO_TEST_ADD 0xC26 /* add test (to batch) */ +#define LSTIO_BATCH_QUERY 0xC27 /* query batch status */ +#define LSTIO_STAT_QUERY 0xC30 /* get stats */ + +typedef struct { + lnet_nid_t ses_nid; /* nid of console node */ + __u64 ses_stamp; /* time stamp */ +} lst_sid_t; /*** session id */ extern lst_sid_t LST_INVALID_SID; typedef struct { - __u64 bat_id; /* unique id in session */ -} lst_bid_t; /*** batch id (group of tests) */ + __u64 bat_id; /* unique id in session */ +} lst_bid_t; /*** batch id (group of tests) */ /* Status of test node */ -#define LST_NODE_ACTIVE 0x1 /* node in this session */ -#define LST_NODE_BUSY 0x2 /* node is taken by other session */ -#define LST_NODE_DOWN 0x4 /* node is down */ -#define LST_NODE_UNKNOWN 0x8 /* node not in session */ +#define LST_NODE_ACTIVE 0x1 /* node in this session */ +#define LST_NODE_BUSY 0x2 /* node is taken by other session */ +#define LST_NODE_DOWN 0x4 /* node is down */ +#define LST_NODE_UNKNOWN 0x8 /* node not in session */ typedef struct { - lnet_process_id_t nde_id; /* id of node */ - int nde_state; /* state of node */ -} lstcon_node_ent_t; /*** node entry, for list_group command */ + lnet_process_id_t nde_id; /* id of node */ + int nde_state; /* state of node */ +} lstcon_node_ent_t; /*** node entry, for list_group command */ typedef struct { - int nle_nnode; /* # of nodes */ - int nle_nactive; /* # of active nodes */ - int nle_nbusy; /* # of busy nodes */ - int nle_ndown; /* # of down nodes */ - int nle_nunknown; /* # of unknown nodes */ -} lstcon_ndlist_ent_t; /*** node_list entry, for list_batch command */ + int nle_nnode; /* # of nodes */ + int nle_nactive; /* # of active nodes */ + int nle_nbusy; /* # of busy nodes */ + int nle_ndown; /* # of down nodes */ + int nle_nunknown; /* # of unknown nodes */ +} lstcon_ndlist_ent_t; /*** node_list entry, for list_batch command */ typedef struct { - int tse_type; /* test type */ - int tse_loop; /* loop count */ - int tse_concur; /* concurrency of test */ -} lstcon_test_ent_t; /*** test summary entry, for list_batch command */ + int tse_type; /* test type */ + int tse_loop; /* loop count */ + int tse_concur; /* concurrency of test */ +} lstcon_test_ent_t; /*** test summary entry, for + *** list_batch command */ typedef struct { - int bae_state; /* batch status */ - int bae_timeout; /* batch timeout */ - int bae_ntest; /* # of tests in the batch */ -} lstcon_batch_ent_t; /*** batch summary entry, for list_batch command */ + int bae_state; /* batch status */ + int bae_timeout; /* batch timeout */ + int bae_ntest; /* # of tests in the batch */ +} lstcon_batch_ent_t; /*** batch summary entry, for + *** list_batch command */ typedef struct { - lstcon_ndlist_ent_t tbe_cli_nle; /* client (group) node_list entry */ - lstcon_ndlist_ent_t tbe_srv_nle; /* server (group) node_list entry */ + lstcon_ndlist_ent_t tbe_cli_nle; /* client (group) node_list + * entry */ + lstcon_ndlist_ent_t tbe_srv_nle; /* server (group) node_list + * entry */ union { - lstcon_test_ent_t tbe_test; /* test entry */ - lstcon_batch_ent_t tbe_batch; /* batch entry */ + lstcon_test_ent_t tbe_test; /* test entry */ + lstcon_batch_ent_t tbe_batch; /* batch entry */ } u; -} lstcon_test_batch_ent_t; /*** test/batch verbose information entry, - *** for list_batch command */ +} lstcon_test_batch_ent_t; /*** test/batch verbose information entry, + *** for list_batch command */ typedef struct { - struct list_head rpe_link; /* link chain */ - lnet_process_id_t rpe_peer; /* peer's id */ - struct timeval rpe_stamp; /* time stamp of RPC */ - int rpe_state; /* peer's state */ - int rpe_rpc_errno; /* RPC errno */ + struct list_head rpe_link; /* link chain */ + lnet_process_id_t rpe_peer; /* peer's id */ + struct timeval rpe_stamp; /* time stamp of RPC */ + int rpe_state; /* peer's state */ + int rpe_rpc_errno; /* RPC errno */ - lst_sid_t rpe_sid; /* peer's session id */ - int rpe_fwk_errno; /* framework errno */ - int rpe_priv[4]; /* private data */ - char rpe_payload[0]; /* private reply payload */ + lst_sid_t rpe_sid; /* peer's session id */ + int rpe_fwk_errno; /* framework errno */ + int rpe_priv[4]; /* private data */ + char rpe_payload[0]; /* private reply payload */ } lstcon_rpc_ent_t; typedef struct { - int trs_rpc_stat[4]; /* RPCs stat (0: total, 1: failed, 2: finished, 4: reserved */ - int trs_rpc_errno; /* RPC errno */ - int trs_fwk_stat[8]; /* framework stat */ - int trs_fwk_errno; /* errno of the first remote error */ - void *trs_fwk_private; /* private framework stat */ + int trs_rpc_stat[4]; /* RPCs stat (0: total + 1: failed + 2: finished + 4: reserved */ + int trs_rpc_errno; /* RPC errno */ + int trs_fwk_stat[8]; /* framework stat */ + int trs_fwk_errno; /* errno of the first remote error */ + void *trs_fwk_private; /* private framework stat */ } lstcon_trans_stat_t; static inline int @@ -236,234 +244,263 @@ lstcon_statqry_stat_failure(lstcon_trans_stat_t *stat, int inc) /* create a session */ typedef struct { - int lstio_ses_key; /* IN: local key */ - int lstio_ses_timeout; /* IN: session timeout */ - int lstio_ses_force; /* IN: force create ? */ + int lstio_ses_key; /* IN: local key */ + int lstio_ses_timeout; /* IN: session timeout */ + int lstio_ses_force; /* IN: force create ? */ /** IN: session features */ - unsigned lstio_ses_feats; - lst_sid_t *lstio_ses_idp; /* OUT: session id */ - int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* IN: session name */ + unsigned lstio_ses_feats; + lst_sid_t *lstio_ses_idp; /* OUT: session id */ + int lstio_ses_nmlen; /* IN: name length */ + char *lstio_ses_namep; /* IN: session name */ } lstio_session_new_args_t; /* query current session */ typedef struct { - lst_sid_t *lstio_ses_idp; /* OUT: session id */ - int *lstio_ses_keyp; /* OUT: local key */ + lst_sid_t *lstio_ses_idp; /* OUT: session id */ + int *lstio_ses_keyp; /* OUT: local key */ /** OUT: session features */ - unsigned *lstio_ses_featp; - lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */ - int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* OUT: session name */ + unsigned *lstio_ses_featp; + lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */ + int lstio_ses_nmlen; /* IN: name length */ + char *lstio_ses_namep; /* OUT: session name */ } lstio_session_info_args_t; /* delete a session */ typedef struct { - int lstio_ses_key; /* IN: session key */ + int lstio_ses_key; /* IN: session key */ } lstio_session_end_args_t; -#define LST_OPC_SESSION 1 -#define LST_OPC_GROUP 2 -#define LST_OPC_NODES 3 +#define LST_OPC_SESSION 1 +#define LST_OPC_GROUP 2 +#define LST_OPC_NODES 3 #define LST_OPC_BATCHCLI 4 #define LST_OPC_BATCHSRV 5 typedef struct { - int lstio_dbg_key; /* IN: session key */ - int lstio_dbg_type; /* IN: debug sessin|batch|group|nodes list */ - int lstio_dbg_flags; /* IN: reserved debug flags */ - int lstio_dbg_timeout; /* IN: timeout of debug */ - - int lstio_dbg_nmlen; /* IN: len of name */ - char *lstio_dbg_namep; /* IN: name of group|batch */ - int lstio_dbg_count; /* IN: # of test nodes to debug */ - lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test nodes */ - struct list_head *lstio_dbg_resultp; /* OUT: list head of result buffer */ + int lstio_dbg_key; /* IN: session key */ + int lstio_dbg_type; /* IN: debug + session|batch| + group|nodes + list */ + int lstio_dbg_flags; /* IN: reserved debug + flags */ + int lstio_dbg_timeout; /* IN: timeout of + debug */ + int lstio_dbg_nmlen; /* IN: len of name */ + char *lstio_dbg_namep; /* IN: name of + group|batch */ + int lstio_dbg_count; /* IN: # of test nodes + to debug */ + lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test + nodes */ + struct list_head *lstio_dbg_resultp; /* OUT: list head of + result buffer */ } lstio_debug_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ } lstio_group_add_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ } lstio_group_del_args_t; -#define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */ -#define LST_GROUP_REFRESH 2 /* refresh inactive nodes in the group */ -#define LST_GROUP_RMND 3 /* delete nodes from the group */ - -typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_opc; /* IN: OPC */ - int lstio_grp_args; /* IN: arguments */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ - int lstio_grp_count; /* IN: # of nodes id */ - lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */ - struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */ +#define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */ +#define LST_GROUP_REFRESH 2 /* refresh inactive nodes + * in the group */ +#define LST_GROUP_RMND 3 /* delete nodes from the group */ + +typedef struct { + int lstio_grp_key; /* IN: session key */ + int lstio_grp_opc; /* IN: OPC */ + int lstio_grp_args; /* IN: arguments */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_count; /* IN: # of nodes id */ + lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */ + struct list_head *lstio_grp_resultp; /* OUT: list head of + result buffer */ } lstio_group_update_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ - int lstio_grp_count; /* IN: # of nodes */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name length */ + char *lstio_grp_namep; /* IN: group name */ + int lstio_grp_count; /* IN: # of nodes */ /** OUT: session features */ - unsigned *lstio_grp_featp; - lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */ - struct list_head *lstio_grp_resultp; /* OUT: list head of result buffer */ + unsigned *lstio_grp_featp; + lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */ + struct list_head *lstio_grp_resultp; /* OUT: list head of + result buffer */ } lstio_group_nodes_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_idx; /* IN: group idx */ - int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* OUT: name */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_idx; /* IN: group idx */ + int lstio_grp_nmlen; /* IN: name len */ + char *lstio_grp_namep; /* OUT: name */ } lstio_group_list_args_t; typedef struct { - int lstio_grp_key; /* IN: session key */ - int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* IN: name */ - lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of group */ - - int *lstio_grp_idxp; /* IN/OUT: node index */ - int *lstio_grp_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */ + int lstio_grp_key; /* IN: session key */ + int lstio_grp_nmlen; /* IN: name len */ + char *lstio_grp_namep; /* IN: name */ + lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of + group */ + int *lstio_grp_idxp; /* IN/OUT: node index */ + int *lstio_grp_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */ } lstio_group_info_args_t; -#define LST_DEFAULT_BATCH "batch" /* default batch name */ +#define LST_DEFAULT_BATCH "batch" /* default batch name */ typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ } lstio_batch_add_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ } lstio_batch_del_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_timeout; /* IN: timeout for the batch */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_timeout; /* IN: timeout for + the batch */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ + struct list_head *lstio_bat_resultp; /* OUT: list head of + result buffer */ } lstio_batch_run_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_force; /* IN: abort unfinished test RPC */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_force; /* IN: abort unfinished + test RPC */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ + struct list_head *lstio_bat_resultp; /* OUT: list head of + result buffer */ } lstio_batch_stop_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_testidx; /* IN: test index */ - int lstio_bat_client; /* IN: is test client? */ - int lstio_bat_timeout; /* IN: timeout for waiting */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ - struct list_head *lstio_bat_resultp; /* OUT: list head of result buffer */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_testidx; /* IN: test index */ + int lstio_bat_client; /* IN: we testing + client? */ + int lstio_bat_timeout; /* IN: timeout for + waiting */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ + struct list_head *lstio_bat_resultp; /* OUT: list head of + result buffer */ } lstio_batch_query_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_idx; /* IN: index */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_idx; /* IN: index */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: batch name */ } lstio_batch_list_args_t; typedef struct { - int lstio_bat_key; /* IN: session key */ - int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: name */ - int lstio_bat_server; /* IN: query server or not */ - int lstio_bat_testidx; /* IN: test index */ - lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */ + int lstio_bat_key; /* IN: session key */ + int lstio_bat_nmlen; /* IN: name length */ + char *lstio_bat_namep; /* IN: name */ + int lstio_bat_server; /* IN: query server + or not */ + int lstio_bat_testidx; /* IN: test index */ + lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */ - int *lstio_bat_idxp; /* IN/OUT: index of node */ - int *lstio_bat_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */ + int *lstio_bat_idxp; /* IN/OUT: index of node */ + int *lstio_bat_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */ } lstio_batch_info_args_t; /* add stat in session */ typedef struct { - int lstio_sta_key; /* IN: session key */ - int lstio_sta_timeout; /* IN: timeout for stat request */ - int lstio_sta_nmlen; /* IN: group name length */ - char *lstio_sta_namep; /* IN: group name */ - int lstio_sta_count; /* IN: # of pid */ - lnet_process_id_t *lstio_sta_idsp; /* IN: pid */ - struct list_head *lstio_sta_resultp; /* OUT: list head of result buffer */ + int lstio_sta_key; /* IN: session key */ + int lstio_sta_timeout; /* IN: timeout for + stat request */ + int lstio_sta_nmlen; /* IN: group name + length */ + char *lstio_sta_namep; /* IN: group name */ + int lstio_sta_count; /* IN: # of pid */ + lnet_process_id_t *lstio_sta_idsp; /* IN: pid */ + struct list_head *lstio_sta_resultp; /* OUT: list head of + result buffer */ } lstio_stat_args_t; typedef enum { - LST_TEST_BULK = 1, - LST_TEST_PING = 2 + LST_TEST_BULK = 1, + LST_TEST_PING = 2 } lst_test_type_t; /* create a test in a batch */ -#define LST_MAX_CONCUR 1024 /* Max concurrency of test */ - -typedef struct { - int lstio_tes_key; /* IN: session key */ - int lstio_tes_bat_nmlen; /* IN: batch name len */ - char *lstio_tes_bat_name; /* IN: batch name */ - int lstio_tes_type; /* IN: test type */ - int lstio_tes_oneside; /* IN: one sided test */ - int lstio_tes_loop; /* IN: loop count */ - int lstio_tes_concur; /* IN: concurrency */ - - int lstio_tes_dist; /* IN: node distribution in destination groups */ - int lstio_tes_span; /* IN: node span in destination groups */ - int lstio_tes_sgrp_nmlen; /* IN: source group name length */ - char *lstio_tes_sgrp_name; /* IN: group name */ - int lstio_tes_dgrp_nmlen; /* IN: destination group name length */ - char *lstio_tes_dgrp_name; /* IN: group name */ - - int lstio_tes_param_len; /* IN: param buffer len */ - void *lstio_tes_param; /* IN: parameter for specified test: - lstio_bulk_param_t, - lstio_ping_param_t, - ... more */ - int *lstio_tes_retp; /* OUT: private returned value */ - struct list_head *lstio_tes_resultp; /* OUT: list head of result buffer */ +#define LST_MAX_CONCUR 1024 /* Max concurrency of test */ + +typedef struct { + int lstio_tes_key; /* IN: session key */ + int lstio_tes_bat_nmlen; /* IN: batch name len */ + char *lstio_tes_bat_name; /* IN: batch name */ + int lstio_tes_type; /* IN: test type */ + int lstio_tes_oneside; /* IN: one sided test */ + int lstio_tes_loop; /* IN: loop count */ + int lstio_tes_concur; /* IN: concurrency */ + + int lstio_tes_dist; /* IN: node distribution in + destination groups */ + int lstio_tes_span; /* IN: node span in + destination groups */ + int lstio_tes_sgrp_nmlen; /* IN: source group + name length */ + char *lstio_tes_sgrp_name; /* IN: group name */ + int lstio_tes_dgrp_nmlen; /* IN: destination group + name length */ + char *lstio_tes_dgrp_name; /* IN: group name */ + + int lstio_tes_param_len; /* IN: param buffer len */ + void *lstio_tes_param; /* IN: parameter for specified + test: + lstio_bulk_param_t, + lstio_ping_param_t, + ... more */ + int *lstio_tes_retp; /* OUT: private returned + value */ + struct list_head *lstio_tes_resultp; /* OUT: list head of + result buffer */ } lstio_test_args_t; typedef enum { - LST_BRW_READ = 1, - LST_BRW_WRITE = 2 + LST_BRW_READ = 1, + LST_BRW_WRITE = 2 } lst_brw_type_t; typedef enum { - LST_BRW_CHECK_NONE = 1, - LST_BRW_CHECK_SIMPLE = 2, - LST_BRW_CHECK_FULL = 3 + LST_BRW_CHECK_NONE = 1, + LST_BRW_CHECK_SIMPLE = 2, + LST_BRW_CHECK_FULL = 3 } lst_brw_flags_t; typedef struct { - int blk_opc; /* bulk operation code */ - int blk_size; /* size (bytes) */ - int blk_time; /* time of running the test*/ - int blk_flags; /* reserved flags */ + int blk_opc; /* bulk operation code */ + int blk_size; /* size (bytes) */ + int blk_time; /* time of running the test*/ + int blk_flags; /* reserved flags */ } lst_test_bulk_param_t; typedef struct { - int png_size; /* size of ping message */ - int png_time; /* time */ - int png_loop; /* loop */ - int png_flags; /* reserved flags */ + int png_size; /* size of ping message */ + int png_time; /* time */ + int png_loop; /* loop */ + int png_flags; /* reserved flags */ } lst_test_ping_param_t; typedef struct { diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index f7c7b08..4c790bd 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -42,29 +42,29 @@ #define SOCKLND_CONN_NONE (-1) #define SOCKLND_CONN_ANY 0 -#define SOCKLND_CONN_CONTROL 1 -#define SOCKLND_CONN_BULK_IN 2 -#define SOCKLND_CONN_BULK_OUT 3 -#define SOCKLND_CONN_NTYPES 4 +#define SOCKLND_CONN_CONTROL 1 +#define SOCKLND_CONN_BULK_IN 2 +#define SOCKLND_CONN_BULK_OUT 3 +#define SOCKLND_CONN_NTYPES 4 #define SOCKLND_CONN_ACK SOCKLND_CONN_BULK_IN typedef struct { - __u32 kshm_magic; /* magic number of socklnd message */ - __u32 kshm_version; /* version of socklnd message */ - lnet_nid_t kshm_src_nid; /* sender's nid */ - lnet_nid_t kshm_dst_nid; /* destination nid */ - lnet_pid_t kshm_src_pid; /* sender's pid */ - lnet_pid_t kshm_dst_pid; /* destination pid */ - __u64 kshm_src_incarnation; /* sender's incarnation */ - __u64 kshm_dst_incarnation; /* destination's incarnation */ - __u32 kshm_ctype; /* connection type */ - __u32 kshm_nips; /* # IP addrs */ - __u32 kshm_ips[0]; /* IP addrs */ + __u32 kshm_magic; /* magic number of socklnd message */ + __u32 kshm_version; /* version of socklnd message */ + lnet_nid_t kshm_src_nid; /* sender's nid */ + lnet_nid_t kshm_dst_nid; /* destination nid */ + lnet_pid_t kshm_src_pid; /* sender's pid */ + lnet_pid_t kshm_dst_pid; /* destination pid */ + __u64 kshm_src_incarnation; /* sender's incarnation */ + __u64 kshm_dst_incarnation; /* destination's incarnation */ + __u32 kshm_ctype; /* connection type */ + __u32 kshm_nips; /* # IP addrs */ + __u32 kshm_ips[0]; /* IP addrs */ } WIRE_ATTR ksock_hello_msg_t; typedef struct { - lnet_hdr_t ksnm_hdr; /* lnet hdr */ + lnet_hdr_t ksnm_hdr; /* lnet hdr */ /* * ksnm_payload is removed because of winnt compiler's limitation: @@ -75,28 +75,29 @@ typedef struct { } WIRE_ATTR ksock_lnet_msg_t; typedef struct { - __u32 ksm_type; /* type of socklnd message */ - __u32 ksm_csum; /* checksum if != 0 */ - __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ + __u32 ksm_type; /* type of socklnd message */ + __u32 ksm_csum; /* checksum if != 0 */ + __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ union { - ksock_lnet_msg_t lnetmsg; /* lnet message, it's empty if it's NOOP */ + ksock_lnet_msg_t lnetmsg;/* lnet message, it's empty if + * it's NOOP */ } WIRE_ATTR ksm_u; } WIRE_ATTR ksock_msg_t; static inline void socklnd_init_msg(ksock_msg_t *msg, int type) { - msg->ksm_csum = 0; - msg->ksm_type = type; - msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0; + msg->ksm_csum = 0; + msg->ksm_type = type; + msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0; } -#define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */ -#define KSOCK_MSG_LNET 0xc1 /* lnet msg */ +#define KSOCK_MSG_NOOP 0xC0 /* ksm_u empty */ +#define KSOCK_MSG_LNET 0xC1 /* lnet msg */ /* We need to know this number to parse hello msg from ksocklnd in * other LND (usocklnd, for example) */ -#define KSOCK_PROTO_V2 2 -#define KSOCK_PROTO_V3 3 +#define KSOCK_PROTO_V2 2 +#define KSOCK_PROTO_V3 3 #endif diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 32b9431..06d73c0 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -48,7 +48,7 @@ /** Portal reserved for LNet's own use. * \see lustre/include/lustre/lustre_idl.h for Lustre portal assignments. */ -#define LNET_RESERVED_PORTAL 0 +#define LNET_RESERVED_PORTAL 0 /** * Address of an end-point in an LNet network. @@ -68,15 +68,15 @@ typedef __u64 lnet_nid_t; typedef __u32 lnet_pid_t; /** wildcard NID that matches any end-point address */ -#define LNET_NID_ANY ((lnet_nid_t) -1) +#define LNET_NID_ANY ((lnet_nid_t) -1) /** wildcard PID that matches any lnet_pid_t */ -#define LNET_PID_ANY ((lnet_pid_t) -1) +#define LNET_PID_ANY ((lnet_pid_t) -1) #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */ #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */ #define LNET_PID_LUSTRE 12345 -#define LNET_TIME_FOREVER (-1) +#define LNET_TIME_FOREVER (-1) /* how an LNET NID encodes net:address */ /** extract the address part of an lnet_nid_t */ @@ -380,8 +380,8 @@ typedef struct { * one must start on page boundary, and all but the last must end on * page boundary. */ - void *start; - unsigned int length; + void *start; + unsigned int length; /** * Specifies the maximum number of operations that can be performed * on the memory descriptor. An operation is any action that could @@ -392,7 +392,7 @@ typedef struct { * there is no bound on the number of operations that may be applied * to a MD. */ - int threshold; + int threshold; /** * Specifies the largest incoming request that the memory descriptor * should respond to. When the unused portion of a MD (length - @@ -400,7 +400,7 @@ typedef struct { * does not respond to further operations. This value is only used * if the LNET_MD_MAX_SIZE option is set. */ - int max_size; + int max_size; /** * Specifies the behavior of the memory descriptor. A bitwise OR * of the following values can be used: @@ -437,14 +437,14 @@ typedef struct { * region (i.e. sum of all fragment lengths) must not be less than * \a max_size. */ - unsigned int options; + unsigned int options; /** * A user-specified value that is associated with the memory * descriptor. The value does not need to be a pointer, but must fit * in the space used by a pointer. This value is recorded in events * associated with operations on this MD. */ - void *user_ptr; + void *user_ptr; /** * A handle for the event queue used to log the operations performed on * the memory region. If this argument is a NULL handle (i.e. nullified @@ -461,33 +461,33 @@ typedef struct { #define LNET_MTU (1 << LNET_MTU_BITS) /** limit on the number of fragments in discontiguous MDs */ -#define LNET_MAX_IOV 256 +#define LNET_MAX_IOV 256 /** * Options for the MD structure. See lnet_md_t::options. */ -#define LNET_MD_OP_PUT (1 << 0) +#define LNET_MD_OP_PUT (1 << 0) /** See lnet_md_t::options. */ -#define LNET_MD_OP_GET (1 << 1) +#define LNET_MD_OP_GET (1 << 1) /** See lnet_md_t::options. */ #define LNET_MD_MANAGE_REMOTE (1 << 2) -/* unused (1 << 3) */ +/* unused (1 << 3) */ /** See lnet_md_t::options. */ -#define LNET_MD_TRUNCATE (1 << 4) +#define LNET_MD_TRUNCATE (1 << 4) /** See lnet_md_t::options. */ -#define LNET_MD_ACK_DISABLE (1 << 5) +#define LNET_MD_ACK_DISABLE (1 << 5) /** See lnet_md_t::options. */ #define LNET_MD_IOVEC (1 << 6) /** See lnet_md_t::options. */ -#define LNET_MD_MAX_SIZE (1 << 7) +#define LNET_MD_MAX_SIZE (1 << 7) /** See lnet_md_t::options. */ -#define LNET_MD_KIOV (1 << 8) +#define LNET_MD_KIOV (1 << 8) /* For compatibility with Cray Portals */ -#define LNET_MD_PHYS 0 +#define LNET_MD_PHYS 0 /** Infinite threshold on MD operations. See lnet_md_t::threshold */ -#define LNET_MD_THRESH_INF (-1) +#define LNET_MD_THRESH_INF (-1) /* NB lustre portals uses struct iovec internally! */ typedef struct iovec lnet_md_iovec_t; @@ -497,15 +497,15 @@ typedef struct iovec lnet_md_iovec_t; */ typedef struct { /** Pointer to the page where the fragment resides */ - struct page *kiov_page; + struct page *kiov_page; /** Length in bytes of the fragment */ - unsigned int kiov_len; + unsigned int kiov_len; /** * Starting offset of the fragment within the page. Note that the * end of the fragment must not pass the end of the page; i.e., * kiov_len + kiov_offset <= PAGE_CACHE_SIZE. */ - unsigned int kiov_offset; + unsigned int kiov_offset; } lnet_kiov_t; /** @} lnet_md */ @@ -553,7 +553,7 @@ typedef enum { LNET_EVENT_UNLINK, } lnet_event_kind_t; -#define LNET_SEQ_BASETYPE long +#define LNET_SEQ_BASETYPE long typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t; #define LNET_SEQ_GT(a, b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0) @@ -562,23 +562,23 @@ typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t; */ typedef struct { /** The identifier (nid, pid) of the target. */ - lnet_process_id_t target; + lnet_process_id_t target; /** The identifier (nid, pid) of the initiator. */ - lnet_process_id_t initiator; + lnet_process_id_t initiator; /** * The NID of the immediate sender. If the request has been forwarded * by routers, this is the NID of the last hop; otherwise it's the * same as the initiator. */ - lnet_nid_t sender; + lnet_nid_t sender; /** Indicates the type of the event. */ - lnet_event_kind_t type; + lnet_event_kind_t type; /** The portal table index specified in the request */ - unsigned int pt_index; + unsigned int pt_index; /** A copy of the match bits specified in the request. */ - __u64 match_bits; + __u64 match_bits; /** The length (in bytes) specified in the request. */ - unsigned int rlength; + unsigned int rlength; /** * The length (in bytes) of the data that was manipulated by the * operation. For truncated operations, the manipulated length will be @@ -586,47 +586,47 @@ typedef struct { * see lnet_md_t). For all other operations, the manipulated length * will be the length of the requested operation, i.e. rlength. */ - unsigned int mlength; + unsigned int mlength; /** * The handle to the MD associated with the event. The handle may be * invalid if the MD has been unlinked. */ - lnet_handle_md_t md_handle; + lnet_handle_md_t md_handle; /** * A snapshot of the state of the MD immediately after the event has * been processed. In particular, the threshold field in md will * reflect the value of the threshold after the operation occurred. */ - lnet_md_t md; + lnet_md_t md; /** * 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT. * \see LNetPut */ - __u64 hdr_data; + __u64 hdr_data; /** * Indicates the completion status of the operation. It's 0 for * successful operations, otherwise it's an error code. */ - int status; + int status; /** * Indicates whether the MD has been unlinked. Note that: * - An event with unlinked set is the last event on the MD. * - This field is also set for an explicit LNET_EVENT_UNLINK event. * \see LNetMDUnlink */ - int unlinked; + int unlinked; /** * The displacement (in bytes) into the memory region that the * operation used. The offset can be determined by the operation for * a remote managed MD or by the local MD. * \see lnet_md_t::options */ - unsigned int offset; + unsigned int offset; /** * The sequence number for this event. Sequence numbers are unique * to each event. */ - volatile lnet_seq_t sequence; + volatile lnet_seq_t sequence; } lnet_event_t; /** -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:12 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:12 -0400 Subject: [lustre-devel] [PATCH v4 6/9] staging:lustre: separate kernel and user land defines in the LNet headers In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-7-git-send-email-jsimmons@infradead.org> Currently the lnet headers used by user land contain various internal LNet structures that are only used by kernel space. Move the user land structures to headers used by user land. The kernel structures are relocated to headers that are never exposed to user land. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 3 - .../staging/lustre/include/linux/lnet/lib-types.h | 171 +++----------------- .../staging/lustre/include/linux/lnet/lnetctl.h | 7 +- drivers/staging/lustre/include/linux/lnet/lnetst.h | 5 +- .../staging/lustre/include/linux/lnet/socklnd.h | 1 - drivers/staging/lustre/include/linux/lnet/types.h | 169 ++++++++++++++++++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 3 +- 7 files changed, 180 insertions(+), 179 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 5b3b103..061e171 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -34,8 +34,6 @@ * Lustre is a trademark of Sun Microsystems, Inc. * * lnet/include/lnet/lib-lnet.h - * - * Top level include for library side routines */ #ifndef __LNET_LIB_LNET_H__ @@ -43,7 +41,6 @@ #include "../libcfs/libcfs.h" #include "api.h" -#include "types.h" #include "lnet.h" #include "lib-types.h" diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 4b862d3..fdf94dd 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -42,125 +42,20 @@ #ifndef __LNET_LIB_TYPES_H__ #define __LNET_LIB_TYPES_H__ -#include "../libcfs/libcfs.h" -#include -#include "types.h" - -#define WIRE_ATTR __attribute__((packed)) - -/* Packed version of lnet_process_id_t to transfer via network */ -typedef struct { - lnet_nid_t nid; - lnet_pid_t pid; /* node id / process id */ -} WIRE_ATTR lnet_process_id_packed_t; - -/* The wire handle's interface cookie only matches one network interface in - * one epoch (i.e. new cookie when the interface restarts or the node - * reboots). The object cookie only matches one object on that interface - * during that object's lifetime (i.e. no cookie re-use). */ -typedef struct { - __u64 wh_interface_cookie; - __u64 wh_object_cookie; -} WIRE_ATTR lnet_handle_wire_t; - -typedef enum { - LNET_MSG_ACK = 0, - LNET_MSG_PUT, - LNET_MSG_GET, - LNET_MSG_REPLY, - LNET_MSG_HELLO, -} lnet_msg_type_t; - -/* The variant fields of the portals message header are aligned on an 8 - * byte boundary in the message header. Note that all types used in these - * wire structs MUST be fixed size and the smaller types are placed at the - * end. */ -typedef struct lnet_ack { - lnet_handle_wire_t dst_wmd; - __u64 match_bits; - __u32 mlength; -} WIRE_ATTR lnet_ack_t; - -typedef struct lnet_put { - lnet_handle_wire_t ack_wmd; - __u64 match_bits; - __u64 hdr_data; - __u32 ptl_index; - __u32 offset; -} WIRE_ATTR lnet_put_t; - -typedef struct lnet_get { - lnet_handle_wire_t return_wmd; - __u64 match_bits; - __u32 ptl_index; - __u32 src_offset; - __u32 sink_length; -} WIRE_ATTR lnet_get_t; - -typedef struct lnet_reply { - lnet_handle_wire_t dst_wmd; -} WIRE_ATTR lnet_reply_t; - -typedef struct lnet_hello { - __u64 incarnation; - __u32 type; -} WIRE_ATTR lnet_hello_t; +#include +#include +#include +#include -typedef struct { - lnet_nid_t dest_nid; - lnet_nid_t src_nid; - lnet_pid_t dest_pid; - lnet_pid_t src_pid; - __u32 type; /* lnet_msg_type_t */ - __u32 payload_length; /* payload data to follow */ - /*<------__u64 aligned------->*/ - union { - lnet_ack_t ack; - lnet_put_t put; - lnet_get_t get; - lnet_reply_t reply; - lnet_hello_t hello; - } msg; -} WIRE_ATTR lnet_hdr_t; - -/* A HELLO message contains a magic number and protocol version - * code in the header's dest_nid, the peer's NID in the src_nid, and - * LNET_MSG_HELLO in the type field. All other common fields are zero - * (including payload_size; i.e. no payload). - * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is - * running the same protocol and to find out its NID. These LNDs should - * exchange HELLO messages when a connection is first established. Individual - * LNDs can put whatever else they fancy in lnet_hdr_t::msg. - */ -typedef struct { - __u32 magic; /* LNET_PROTO_TCP_MAGIC */ - __u16 version_major; /* increment on incompatible change */ - __u16 version_minor; /* increment on compatible change */ -} WIRE_ATTR lnet_magicversion_t; - -/* PROTO MAGIC for LNDs */ -#define LNET_PROTO_IB_MAGIC 0x0be91b91 -#define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */ -#define LNET_PROTO_TCP_MAGIC 0xeebc0ded -#define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100 -#define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */ - -/* Placeholder for a future "unified" protocol across all LNDs */ -/* Current LNDs that receive a request with this magic will respond with a - * "stub" reply using their current protocol */ -#define LNET_PROTO_MAGIC 0x45726963 /* ! */ - -#define LNET_PROTO_TCP_VERSION_MAJOR 1 -#define LNET_PROTO_TCP_VERSION_MINOR 0 - -/* Acceptor connection request */ -typedef struct { - __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */ - __u32 acr_version; /* protocol version */ - __u64 acr_nid; /* target NID */ -} WIRE_ATTR lnet_acceptor_connreq_t; +#include "types.h" -#define LNET_PROTO_ACCEPTOR_VERSION 1 +/* Max payload size */ +#define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD +#if (LNET_MAX_PAYLOAD < LNET_MTU) +# error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb" +#elif (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV)) +# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" +#endif /* forward refs */ struct lnet_libmd; @@ -295,7 +190,7 @@ typedef struct lnet_lnd { int lnd_refcount; /* # active instances */ /* fields initialised by the LND */ - unsigned int lnd_type; + __u32 lnd_type; int (*lnd_startup)(struct lnet_ni *ni); void (*lnd_shutdown)(struct lnet_ni *ni); @@ -349,15 +244,6 @@ typedef struct lnet_lnd { } lnd_t; -#define LNET_NI_STATUS_UP 0x15aac0de -#define LNET_NI_STATUS_DOWN 0xdeadface -#define LNET_NI_STATUS_INVALID 0x00000000 -typedef struct { - lnet_nid_t ns_nid; - __u32 ns_status; - __u32 ns_unused; -} WIRE_ATTR lnet_ni_status_t; - struct lnet_tx_queue { int tq_credits; /* # tx credits free */ int tq_credits_min; /* lowest it's been */ @@ -365,8 +251,6 @@ struct lnet_tx_queue { struct list_head tq_delayed; /* delayed TXs */ }; -#define LNET_MAX_INTERFACES 16 - typedef struct lnet_ni { spinlock_t ni_lock; struct list_head ni_list; /* chain on ln_nis */ @@ -402,14 +286,6 @@ typedef struct lnet_ni { #define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \ LNET_PING_FEAT_NI_STATUS) -typedef struct { - __u32 pi_magic; - __u32 pi_features; - lnet_pid_t pi_pid; - __u32 pi_nnis; - lnet_ni_status_t pi_ni[0]; -} WIRE_ATTR lnet_ping_info_t; - /* router checker data, per router */ #define LNET_MAX_RTR_NIS 16 #define LNET_PINGINFO_SIZE offsetof(lnet_ping_info_t, pi_ni[LNET_MAX_RTR_NIS]) @@ -492,6 +368,11 @@ typedef struct { __u32 lrn_net; /* my net number */ } lnet_remotenet_t; +/** lnet message has credit and can be submitted to lnd for send/receive */ +#define LNET_CREDIT_OK 0 +/** lnet message is waiting for credit */ +#define LNET_CREDIT_WAIT 1 + typedef struct { struct list_head rbp_bufs; /* my free buffer pool */ struct list_head rbp_msgs; /* messages blocking for a buffer */ @@ -507,23 +388,9 @@ typedef struct { lnet_kiov_t rb_kiov[0]; /* the buffer space */ } lnet_rtrbuf_t; -typedef struct { - __u32 msgs_alloc; - __u32 msgs_max; - __u32 errors; - __u32 send_count; - __u32 recv_count; - __u32 route_count; - __u32 drop_count; - __u64 send_length; - __u64 recv_length; - __u64 route_length; - __u64 drop_length; -} WIRE_ATTR lnet_counters_t; - #define LNET_PEER_HASHSIZE 503 /* prime! */ -#define LNET_NRBPOOLS 3 /* # different router buffer pools */ +#define LNET_NRBPOOLS 3 /* # different router buffer pools */ enum { /* Didn't match anything */ diff --git a/drivers/staging/lustre/include/linux/lnet/lnetctl.h b/drivers/staging/lustre/include/linux/lnet/lnetctl.h index 98181d3..bdd69b2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetctl.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetctl.h @@ -14,12 +14,11 @@ * along with Portals; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * header for libptlctl.a + * header for lnet ioctl */ -#ifndef _PTLCTL_H_ -#define _PTLCTL_H_ +#ifndef _LNETCTL_H_ +#define _LNETCTL_H_ -#include "../libcfs/libcfs.h" #include "types.h" #define LNET_DEV_ID 0 diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 885f708..57432fd 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -41,9 +41,7 @@ #ifndef __LNET_ST_H__ #define __LNET_ST_H__ -#include "../libcfs/libcfs.h" -#include "lnet.h" -#include "lib-types.h" +#include #define LST_FEAT_NONE (0) #define LST_FEAT_BULK_LEN (1 << 0) /* enable variable page size */ @@ -468,7 +466,6 @@ typedef struct { int png_flags; /* reserved flags */ } lst_test_ping_param_t; -/* more tests */ typedef struct { __u32 errors; __u32 rpcs_sent; diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 389038b..f7c7b08 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -39,7 +39,6 @@ #define __LNET_LNET_SOCKLND_H__ #include "types.h" -#include "lib-types.h" #define SOCKLND_CONN_NONE (-1) #define SOCKLND_CONN_ANY 0 diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 15528a1..32b9431 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -37,11 +37,11 @@ #ifndef __LNET_TYPES_H__ #define __LNET_TYPES_H__ +#include + /** \addtogroup lnet * @{ */ -#include "../libcfs/libcfs.h" - /** \addtogroup lnet_addr * @{ */ @@ -74,6 +74,7 @@ typedef __u32 lnet_pid_t; #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */ #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */ +#define LNET_PID_LUSTRE 12345 #define LNET_TIME_FOREVER (-1) @@ -110,7 +111,158 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) return (type << 16) | num; } -/** +#define WIRE_ATTR __packed + +/* Packed version of lnet_process_id_t to transfer via network */ +typedef struct { + /* node id / process id */ + lnet_nid_t nid; + lnet_pid_t pid; +} WIRE_ATTR lnet_process_id_packed_t; + +/* The wire handle's interface cookie only matches one network interface in + * one epoch (i.e. new cookie when the interface restarts or the node + * reboots). The object cookie only matches one object on that interface + * during that object's lifetime (i.e. no cookie re-use). */ +typedef struct { + __u64 wh_interface_cookie; + __u64 wh_object_cookie; +} WIRE_ATTR lnet_handle_wire_t; + +typedef enum { + LNET_MSG_ACK = 0, + LNET_MSG_PUT, + LNET_MSG_GET, + LNET_MSG_REPLY, + LNET_MSG_HELLO, +} lnet_msg_type_t; + +/* The variant fields of the portals message header are aligned on an 8 + * byte boundary in the message header. Note that all types used in these + * wire structs MUST be fixed size and the smaller types are placed at the + * end. */ +typedef struct lnet_ack { + lnet_handle_wire_t dst_wmd; + __u64 match_bits; + __u32 mlength; +} WIRE_ATTR lnet_ack_t; + +typedef struct lnet_put { + lnet_handle_wire_t ack_wmd; + __u64 match_bits; + __u64 hdr_data; + __u32 ptl_index; + __u32 offset; +} WIRE_ATTR lnet_put_t; + +typedef struct lnet_get { + lnet_handle_wire_t return_wmd; + __u64 match_bits; + __u32 ptl_index; + __u32 src_offset; + __u32 sink_length; +} WIRE_ATTR lnet_get_t; + +typedef struct lnet_reply { + lnet_handle_wire_t dst_wmd; +} WIRE_ATTR lnet_reply_t; + +typedef struct lnet_hello { + __u64 incarnation; + __u32 type; +} WIRE_ATTR lnet_hello_t; + +typedef struct { + lnet_nid_t dest_nid; + lnet_nid_t src_nid; + lnet_pid_t dest_pid; + lnet_pid_t src_pid; + __u32 type; /* lnet_msg_type_t */ + __u32 payload_length; /* payload data to follow */ + /*<------__u64 aligned------->*/ + union { + lnet_ack_t ack; + lnet_put_t put; + lnet_get_t get; + lnet_reply_t reply; + lnet_hello_t hello; + } msg; +} WIRE_ATTR lnet_hdr_t; + +/* A HELLO message contains a magic number and protocol version + * code in the header's dest_nid, the peer's NID in the src_nid, and + * LNET_MSG_HELLO in the type field. All other common fields are zero + * (including payload_size; i.e. no payload). + * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is + * running the same protocol and to find out its NID. These LNDs should + * exchange HELLO messages when a connection is first established. Individual + * LNDs can put whatever else they fancy in lnet_hdr_t::msg. + */ +typedef struct { + __u32 magic; /* LNET_PROTO_TCP_MAGIC */ + __u16 version_major; /* increment on incompatible change */ + __u16 version_minor; /* increment on compatible change */ +} WIRE_ATTR lnet_magicversion_t; + +/* PROTO MAGIC for LNDs */ +#define LNET_PROTO_IB_MAGIC 0x0be91b91 +#define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */ +#define LNET_PROTO_TCP_MAGIC 0xeebc0ded +#define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100 +#define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */ + +/* Placeholder for a future "unified" protocol across all LNDs */ +/* Current LNDs that receive a request with this magic will respond with a + * "stub" reply using their current protocol */ +#define LNET_PROTO_MAGIC 0x45726963 /* ! */ + +#define LNET_PROTO_TCP_VERSION_MAJOR 1 +#define LNET_PROTO_TCP_VERSION_MINOR 0 + +/* Acceptor connection request */ +typedef struct { + __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */ + __u32 acr_version; /* protocol version */ + __u64 acr_nid; /* target NID */ +} WIRE_ATTR lnet_acceptor_connreq_t; + +#define LNET_PROTO_ACCEPTOR_VERSION 1 + +typedef struct { + lnet_nid_t ns_nid; + __u32 ns_status; + __u32 ns_unused; +} WIRE_ATTR lnet_ni_status_t; + +typedef struct { + __u32 pi_magic; + __u32 pi_features; + lnet_pid_t pi_pid; + __u32 pi_nnis; + lnet_ni_status_t pi_ni[0]; +} WIRE_ATTR lnet_ping_info_t; + +typedef struct lnet_counters { + __u32 msgs_alloc; + __u32 msgs_max; + __u32 errors; + __u32 send_count; + __u32 recv_count; + __u32 route_count; + __u32 drop_count; + __u64 send_length; + __u64 recv_length; + __u64 route_length; + __u64 drop_length; +} WIRE_ATTR lnet_counters_t; + +#define LNET_NI_STATUS_UP 0x15aac0de +#define LNET_NI_STATUS_DOWN 0xdeadface +#define LNET_NI_STATUS_INVALID 0x00000000 + +#define LNET_MAX_INTERFACES 16 + +/* * Objects maintained by the LNet are accessed through handles. Handle types * have names of the form lnet_handle_xx_t, where xx is one of the two letter * object type codes ('eq' for event queue, 'md' for memory descriptor, and @@ -311,17 +463,6 @@ typedef struct { /** limit on the number of fragments in discontiguous MDs */ #define LNET_MAX_IOV 256 -/* Max payload size */ -# define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD -# if (LNET_MAX_PAYLOAD < LNET_MTU) -# error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb" -# else -# if (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV)) -/* PAGE_SIZE is a constant: check with cpp! */ -# error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb" -# endif -# endif - /** * Options for the MD structure. See lnet_md_t::options. */ diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index a2d0d10..57e9752 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -35,10 +35,11 @@ */ #define DEBUG_SUBSYSTEM S_LNET -#include "../../include/linux/lnet/lib-lnet.h" #include #include +#include "../../include/linux/lnet/lib-lnet.h" + #define D_LNI D_CONSOLE lnet_t the_lnet; /* THE state of the network */ -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:11 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:11 -0400 Subject: [lustre-devel] [PATCH v4 5/9] staging:lustre: move LNet NID macros to LNet layer In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-6-git-send-email-jsimmons@infradead.org> Currently several special macros LNet NID macros exist in libcfs.h and libcfs_private.h. Move those macros out to the lnet header types.h. The new lnet header nidstr.h contains LNet NID string data that can be used by user land LNet utilities and the LNet kernel drivers. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_private.h | 55 -------------- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 + drivers/staging/lustre/include/linux/lnet/lnet.h | 5 +- drivers/staging/lustre/include/linux/lnet/nidstr.h | 76 ++++++++++++++++++++ drivers/staging/lustre/include/linux/lnet/types.h | 33 +++++++++ .../lustre/lustre/include/lustre/lustre_idl.h | 1 + drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- 7 files changed, 114 insertions(+), 61 deletions(-) create mode 100644 drivers/staging/lustre/include/linux/lnet/nidstr.h diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index d8f8543..ed37d26 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -42,14 +42,10 @@ #ifndef __LIBCFS_PRIVATE_H__ #define __LIBCFS_PRIVATE_H__ -/* XXX this layering violation is for nidstrings */ -#include "../lnet/types.h" - #ifndef DEBUG_SUBSYSTEM # define DEBUG_SUBSYSTEM S_UNDEFINED #endif - /* * When this is on, LASSERT macro includes check for assignment used instead * of equality check, but doesn't have unlikely(). Turn this on from time to @@ -410,36 +406,6 @@ int cfs_percpt_atomic_summary(atomic_t **refs); */ #define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } while (0) -/* support decl needed both by kernel and liblustre */ -int libcfs_isknown_lnd(int type); -char *libcfs_lnd2modname(int type); -char *libcfs_lnd2str(int type); -int libcfs_str2lnd(const char *str); -char *libcfs_net2str(__u32 net); -char *libcfs_nid2str(lnet_nid_t nid); -__u32 libcfs_str2net(const char *str); -lnet_nid_t libcfs_str2nid(const char *str); -int libcfs_str2anynid(lnet_nid_t *nid, const char *str); -char *libcfs_id2str(lnet_process_id_t id); -void cfs_free_nidlist(struct list_head *list); -int cfs_parse_nidlist(char *str, int len, struct list_head *list); -int cfs_match_nid(lnet_nid_t nid, struct list_head *list); - -/** \addtogroup lnet_addr - * @{ */ -/* how an LNET NID encodes net:address */ -/** extract the address part of an lnet_nid_t */ -#define LNET_NIDADDR(nid) ((__u32)((nid) & 0xffffffff)) -/** extract the network part of an lnet_nid_t */ -#define LNET_NIDNET(nid) ((__u32)(((nid) >> 32)) & 0xffffffff) -/** make an lnet_nid_t from a network part and an address part */ -#define LNET_MKNID(net, addr) ((((__u64)(net))<<32)|((__u64)(addr))) -/* how net encodes type:number */ -#define LNET_NETNUM(net) ((net) & 0xffff) -#define LNET_NETTYP(net) (((net) >> 16) & 0xffff) -#define LNET_MKNET(typ, num) ((((__u32)(typ))<<16)|((__u32)(num))) -/** @} lnet_addr */ - /* max value for numeric network address */ #define MAX_NUMERIC_VALUE 0xffffffff @@ -519,25 +485,4 @@ do { \ ptr += cfs_size_round(len + 1); \ } while (0) -/** - * Lustre Network Driver types. - */ -enum { - /* Only add to these values (i.e. don't ever change or redefine them): - * network addresses depend on them... */ - QSWLND = 1, - SOCKLND = 2, - GMLND = 3, /* obsolete, keep it so that libcfs_nid2str works */ - PTLLND = 4, - O2IBLND = 5, - CIBLND = 6, - OPENIBLND = 7, - IIBLND = 8, - LOLND = 9, - RALND = 10, - VIBLND = 11, - MXLND = 12, - GNILND = 13, -}; - #endif diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index c46e0e6..5b3b103 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -42,6 +42,7 @@ #define __LNET_LIB_LNET_H__ #include "../libcfs/libcfs.h" +#include "api.h" #include "types.h" #include "lnet.h" #include "lib-types.h" diff --git a/drivers/staging/lustre/include/linux/lnet/lnet.h b/drivers/staging/lustre/include/linux/lnet/lnet.h index 8d054a1..8124d8f 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lnet.h @@ -41,9 +41,6 @@ * User application interface file */ #include "types.h" -#include "api.h" - -#define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */ -#define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */ +#include "nidstr.h" #endif diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h new file mode 100644 index 0000000..8eaed1a --- /dev/null +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -0,0 +1,76 @@ +/* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.gnu.org/licenses/gpl-2.0.html + * + * GPL HEADER END + */ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2011, 2014, Intel Corporation. + */ +#ifndef _LNET_NIDSTRINGS_H +#define _LNET_NIDSTRINGS_H +#include "types.h" + +/** + * Lustre Network Driver types. + */ +enum { + /* Only add to these values (i.e. don't ever change or redefine them): + * network addresses depend on them... */ + QSWLND = 1, + SOCKLND = 2, + GMLND = 3, + PTLLND = 4, + O2IBLND = 5, + CIBLND = 6, + OPENIBLND = 7, + IIBLND = 8, + LOLND = 9, + RALND = 10, + VIBLND = 11, + MXLND = 12, + GNILND = 13, + GNIIPLND = 14, +}; + +struct list_head; + +#define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */ +#define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */ + +int libcfs_isknown_lnd(int type); +char *libcfs_lnd2modname(int type); +char *libcfs_lnd2str(int type); +int libcfs_str2lnd(const char *str); +char *libcfs_net2str(__u32 net); +char *libcfs_nid2str(lnet_nid_t nid); +__u32 libcfs_str2net(const char *str); +lnet_nid_t libcfs_str2nid(const char *str); +int libcfs_str2anynid(lnet_nid_t *nid, const char *str); +char *libcfs_id2str(lnet_process_id_t id); +void cfs_free_nidlist(struct list_head *list); +int cfs_parse_nidlist(char *str, int len, struct list_head *list); +int cfs_match_nid(lnet_nid_t nid, struct list_head *list); +bool cfs_nidrange_is_contiguous(struct list_head *nidlist); +void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, + char *max_nid, size_t nidstr_length); + +#endif /* _LNET_NIDSTRINGS_H */ diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 68d8139..15528a1 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -77,6 +77,39 @@ typedef __u32 lnet_pid_t; #define LNET_TIME_FOREVER (-1) +/* how an LNET NID encodes net:address */ +/** extract the address part of an lnet_nid_t */ + +static inline __u32 LNET_NIDADDR(lnet_nid_t nid) +{ + return nid & 0xffffffff; +} + +static inline __u32 LNET_NIDNET(lnet_nid_t nid) +{ + return (nid >> 32) & 0xffffffff; +} + +static inline lnet_nid_t LNET_MKNID(__u32 net, __u32 addr) +{ + return (((__u64)net) << 32) | addr; +} + +static inline __u32 LNET_NETNUM(__u32 net) +{ + return net & 0xffff; +} + +static inline __u32 LNET_NETTYP(__u32 net) +{ + return (net >> 16) & 0xffff; +} + +static inline __u32 LNET_MKNET(__u32 type, __u32 num) +{ + return (type << 16) | num; +} + /** * Objects maintained by the LNet are accessed through handles. Handle types * have names of the form lnet_handle_xx_t, where xx is one of the two letter diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 305ecbe..4d72d6e 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -92,6 +92,7 @@ #define _LUSTRE_IDL_H_ #include "../../../include/linux/libcfs/libcfs.h" +#include "../../../include/linux/lnet/types.h" /* Defn's shared with user-space. */ #include "lustre_user.h" diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 998dcd9..77a7de9 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -56,8 +56,8 @@ */ #include "../../include/linux/libcfs/libcfs.h" -// #include -#include "../../include/linux/lnet/lnet.h" +#include "../../include/linux/lnet/nidstr.h" +#include "../../include/linux/lnet/api.h" #include "lustre/lustre_idl.h" #include "lustre_ha.h" #include "lustre_sec.h" -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:09 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:09 -0400 Subject: [lustre-devel] [PATCH v4 3/9] staging:lustre: rename socklnd_lib-linux.c In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-4-git-send-email-jsimmons@infradead.org> From: John L. Hammond With the move to support only the linux kernel their is no need to keep "linux" in the socklnd source file names. This is broken out of the original patch 12932 that was merged to the Intel/OpenSFS branch. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/12932 Reviewed-by: Isaac Huang Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/klnds/socklnd/Makefile | 2 +- .../socklnd/{socklnd_lib-linux.c => socklnd_lib.c} | 0 2 files changed, 1 insertions(+), 1 deletions(-) rename drivers/staging/lustre/lnet/klnds/socklnd/{socklnd_lib-linux.c => socklnd_lib.c} (100%) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/Makefile b/drivers/staging/lustre/lnet/klnds/socklnd/Makefile index f3fb877..c011581 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/Makefile +++ b/drivers/staging/lustre/lnet/klnds/socklnd/Makefile @@ -1,3 +1,3 @@ obj-$(CONFIG_LNET) += ksocklnd.o -ksocklnd-y := socklnd.o socklnd_cb.o socklnd_proto.o socklnd_modparams.o socklnd_lib-linux.o +ksocklnd-y := socklnd.o socklnd_cb.o socklnd_proto.o socklnd_modparams.o socklnd_lib.o diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c similarity index 100% rename from drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c rename to drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:13 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:13 -0400 Subject: [lustre-devel] [PATCH v4 7/9] staging:lustre: fix camel case for LNetInit and LNetFini In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-8-git-send-email-jsimmons@infradead.org> For the functions LNetInit and LNetFini move away from camel case to lnet_init and lnet_fini. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/api.h | 3 --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 3 +++ .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 16 ++++++++-------- drivers/staging/lustre/lnet/lnet/module.c | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index c4dc1b2..dee7f27 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -52,9 +52,6 @@ /** \defgroup lnet_init_fini Initialization and cleanup * The LNet must be properly initialized before any LNet calls can be made. * @{ */ -int LNetInit(void); -void LNetFini(void); - int LNetNIInit(lnet_pid_t requested_pid); int LNetNIFini(void); /** @} lnet_init_fini */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 061e171..6246e2e 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -434,6 +434,9 @@ lnet_ni_t *lnet_nid2ni_locked(lnet_nid_t nid, int cpt); lnet_ni_t *lnet_net2ni_locked(__u32 net, int cpt); lnet_ni_t *lnet_net2ni(__u32 net); +int lnet_init(void); +void lnet_fini(void); + int lnet_notify(lnet_ni_t *ni, lnet_nid_t peer, int alive, unsigned long when); void lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index fdf94dd..8e8e725 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -575,7 +575,7 @@ typedef struct { struct mutex ln_api_mutex; struct mutex ln_lnd_mutex; - int ln_init; /* LNetInit() called? */ + int ln_init; /* lnet_init() called? */ /* Have I called LNetNIInit myself? */ int ln_niinit_self; /* LNetNIInit/LNetNIFini counter */ diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 57e9752..d14fe70 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1101,14 +1101,14 @@ lnet_startup_lndnis(void) * Initialize LNet library. * * Only userspace program needs to call this function - it's automatically - * called in the kernel at module loading time. Caller has to call LNetFini() - * after a call to LNetInit(), if and only if the latter returned 0. It must + * called in the kernel at module loading time. Caller has to call lnet_fini() + * after a call to lnet_init(), if and only if the latter returned 0. It must * be called exactly once. * * \return 0 on success, and -ve on failures. */ int -LNetInit(void) +lnet_init(void) { int rc; @@ -1161,7 +1161,7 @@ LNetInit(void) lnet_register_lnd(&the_lolnd); return 0; } -EXPORT_SYMBOL(LNetInit); +EXPORT_SYMBOL(lnet_init); /** * Finalize LNet library. @@ -1169,11 +1169,11 @@ EXPORT_SYMBOL(LNetInit); * Only userspace program needs to call this function. It can be called * at most once. * - * \pre LNetInit() called with success. + * \pre lnet_init() called with success. * \pre All LNet users called LNetNIFini() for matching LNetNIInit() calls. */ void -LNetFini(void) +lnet_fini(void) { LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_refcount == 0); @@ -1185,12 +1185,12 @@ LNetFini(void) the_lnet.ln_init = 0; } -EXPORT_SYMBOL(LNetFini); +EXPORT_SYMBOL(lnet_fini); /** * Set LNet PID and start LNet interfaces, routing, and forwarding. * - * Userspace program should call this after a successful call to LNetInit(). + * Userspace program should call this after a successful call to lnet_init(). * Users must call this function at least once before any other functions. * For each successful call there must be a corresponding call to * LNetNIFini(). For subsequent calls to LNetNIInit(), \a requested_pid is diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index 6881b9c..576201a 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -117,9 +117,9 @@ init_lnet(void) mutex_init(&lnet_config_mutex); - rc = LNetInit(); + rc = lnet_init(); if (rc != 0) { - CERROR("LNetInit: error %d\n", rc); + CERROR("lnet_init: error %d\n", rc); return rc; } @@ -143,7 +143,7 @@ fini_lnet(void) rc = libcfs_deregister_ioctl(&lnet_ioctl_handler); LASSERT(rc == 0); - LNetFini(); + lnet_fini(); } MODULE_AUTHOR("Peter J. Braam "); -- 1.7.1 From jsimmons at infradead.org Thu Jun 11 19:18:15 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 11 Jun 2015 15:18:15 -0400 Subject: [lustre-devel] [PATCH v4 9/9] staging:lustre: Update license and copyright for the LNET headers In-Reply-To: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> Message-ID: <1434050295-10986-10-git-send-email-jsimmons@infradead.org> Point to the right place for GNU license. Update Intel copyright. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/api.h | 13 +++++-------- .../staging/lustre/include/linux/lnet/lib-lnet.h | 10 +++------- .../staging/lustre/include/linux/lnet/lib-types.h | 13 +++---------- drivers/staging/lustre/include/linux/lnet/lnet.h | 10 ++++------ drivers/staging/lustre/include/linux/lnet/lnetst.h | 12 ++++-------- drivers/staging/lustre/include/linux/lnet/nidstr.h | 3 ++- .../staging/lustre/include/linux/lnet/socklnd.h | 12 ++++-------- drivers/staging/lustre/include/linux/lnet/types.h | 10 +++------- 8 files changed, 28 insertions(+), 55 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index 2eb0a05..9493d5e 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -15,21 +15,19 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. */ #ifndef __LNET_API_H__ @@ -41,9 +39,8 @@ * * LNet is an asynchronous message-passing API, which provides an unreliable * connectionless service that can't guarantee any order. It supports OFA IB, - * TCP/IP, and Cray Portals, and routes between heterogeneous networks. + * TCP/IP, and Cray Interconnects, and routes between heterogeneous networks. * - * LNet can run both in OS kernel space and in userspace as a library. * @{ */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 0dbab6f..a9c9a07 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,11 +23,11 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. * * lnet/include/lnet/lib-lnet.h */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index fa949d8..81a63db 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,16 +23,13 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. * * lnet/include/lnet/lib-types.h - * - * Types used by the library side routines that do not need to be - * exposed to the user application */ #ifndef __LNET_LIB_TYPES_H__ diff --git a/drivers/staging/lustre/include/linux/lnet/lnet.h b/drivers/staging/lustre/include/linux/lnet/lnet.h index 8124d8f..5d1559a 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lnet.h @@ -15,21 +15,19 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. */ #ifndef __LNET_H__ diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index ea1e0c6..fd1e0fd 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,15 +23,15 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, Intel Corporation. + * Copyright (c) 2011 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. * * lnet/include/lnet/lnetst.h * - * Author: Liang Zhen + * Author: Liang Zhen */ #ifndef __LNET_ST_H__ diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 8eaed1a..a627be9 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -23,10 +23,11 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2014, Intel Corporation. + * Copyright (c) 2011 - 2015, Intel Corporation. */ #ifndef _LNET_NIDSTRINGS_H #define _LNET_NIDSTRINGS_H + #include "types.h" /** diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 4c790bd..599c9f6 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -15,25 +15,21 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. * * lnet/include/lnet/socklnd.h - * - * #defines shared between socknal implementation and utilities */ #ifndef __LNET_LNET_SOCKLND_H__ #define __LNET_LNET_SOCKLND_H__ diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 06d73c0..940f73f 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,11 +23,11 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012 - 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. + * Lustre is a trademark of Seagate, Inc. */ #ifndef __LNET_TYPES_H__ -- 1.7.1 From jmiller at cray.com Fri Jun 12 21:04:51 2015 From: jmiller at cray.com (Justin Miller) Date: Fri, 12 Jun 2015 21:04:51 +0000 Subject: [lustre-devel] lustre design docs In-Reply-To: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> References: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> Message-ID: <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> I think a central document repository is a good idea, and would be a valuable asset. The plan you outline to collect the documents and metadata first and then convert the most useful documents to a maintainable format makes a lot of sense. In addition to the benefits you identify, it may also allow for the collection of some interesting metrics. I’d be happy to help with this project. - Justin Miller On 5/20/15, 1:06 PM, "lustre-devel on behalf of Vitaly Fertman" wrote: >Hi All, > >there was an idea to publish existing design docs on opensfs wiki. >is centralised design repository interesting at all? > >currently the existing designs are not in the wiki format, mostly pdf, so this is >not an ideal doc repository we want to have: not changeable, not maintainable, >could be outdated, etc, but could be published very quickly. > >however, this is not the final step but just a beginning. at the same time, we may get >some benefits immediately: >- all the docs are gathered in one centralised place, faster doc search; >- the fully documented product (although maybe not very up-to-date initially) — >attractive for many readers, especially newbies; >- a quick jump to unknown code having a design, faster than reading the source code; > >after that, having these docs already published, next steps could be: >- docs to be split on those which are to be maintained and left untouched; >- a procedure of converting to be maintained docs to wiki format could be organised; >- a procedure of updating converted docs to be organised; >etc. > >would be valuable? thoughts? > >— >Vitaly? >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From andreas.dilger at intel.com Fri Jun 12 21:49:04 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Fri, 12 Jun 2015 21:49:04 +0000 Subject: [lustre-devel] lustre design docs In-Reply-To: <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> References: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> Message-ID: On 2015/06/12, 3:04 PM, "Justin Miller" wrote: >I think a central document repository is a good idea, and would be a >valuable asset. The plan you outline to collect the documents and >metadata first and then convert the most useful documents to a >maintainable format makes a lot of sense. In addition to the benefits you >identify, it may also allow for the collection of some interesting >metrics. > >I¹d be happy to help with this project. > >- Justin Miller > > >On 5/20/15, 1:06 PM, "lustre-devel on behalf of Vitaly Fertman" >vitaly.fertman at seagate.com> wrote: > >>Hi All, >> >>there was an idea to publish existing design docs on opensfs wiki. >>is centralised design repository interesting at all? >> >>currently the existing designs are not in the wiki format, mostly pdf, >>so this is >>not an ideal doc repository we want to have: not changeable, not >>maintainable, >>could be outdated, etc, but could be published very quickly. >> >>however, this is not the final step but just a beginning. at the same >>time, we may get >>some benefits immediately: >>- all the docs are gathered in one centralised place, faster doc search; >>- the fully documented product (although maybe not very up-to-date >>initially) ‹ >>attractive for many readers, especially newbies; >>- a quick jump to unknown code having a design, faster than reading the >>source code; >> >>after that, having these docs already published, next steps could be: >>- docs to be split on those which are to be maintained and left >>untouched; >>- a procedure of converting to be maintained docs to wiki format could >>be organised; >>- a procedure of updating converted docs to be organised; >>etc. >> >>would be valuable? thoughts? >> >>‹ >>Vitaly? >>_______________________________________________ >>lustre-devel mailing list >>lustre-devel at lists.lustre.org >>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From andreas.dilger at intel.com Fri Jun 12 21:53:02 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Fri, 12 Jun 2015 21:53:02 +0000 Subject: [lustre-devel] lustre design docs In-Reply-To: <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> References: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> Message-ID: I agree - there are a lot of documents spread across many places (old wiki, new wiki, opensfs wiki, HPDD wiki, old CVS "lustre-doc" repo, etc). Just getting those into a central location would be a good start. Obviously many of those documents are outdated, but I think even those would be valuable as long as it is clear at the top of the document what state it is in (e.g. having the date of origin and a description of the status like obsolete, stale, useful, up-to-date, etc). I think Richard has been uploading some of our more recent design docs to the new wiki, so that would be as good a place to start as any. Cheers, Andreas On 2015/06/12, 3:04 PM, "Justin Miller" wrote: >I think a central document repository is a good idea, and would be a >valuable asset. The plan you outline to collect the documents and >metadata first and then convert the most useful documents to a >maintainable format makes a lot of sense. In addition to the benefits you >identify, it may also allow for the collection of some interesting >metrics. > >I¹d be happy to help with this project. > >- Justin Miller > > >On 5/20/15, 1:06 PM, "lustre-devel on behalf of Vitaly Fertman" >vitaly.fertman at seagate.com> wrote: > >>Hi All, >> >>there was an idea to publish existing design docs on opensfs wiki. >>is centralised design repository interesting at all? >> >>currently the existing designs are not in the wiki format, mostly pdf, >>so this is >>not an ideal doc repository we want to have: not changeable, not >>maintainable, >>could be outdated, etc, but could be published very quickly. >> >>however, this is not the final step but just a beginning. at the same >>time, we may get >>some benefits immediately: >>- all the docs are gathered in one centralised place, faster doc search; >>- the fully documented product (although maybe not very up-to-date >>initially) ‹ >>attractive for many readers, especially newbies; >>- a quick jump to unknown code having a design, faster than reading the >>source code; >> >>after that, having these docs already published, next steps could be: >>- docs to be split on those which are to be maintained and left >>untouched; >>- a procedure of converting to be maintained docs to wiki format could >>be organised; >>- a procedure of updating converted docs to be organised; >>etc. >> >>would be valuable? thoughts? >> >>‹ >>Vitaly? >>_______________________________________________ >>lustre-devel mailing list >>lustre-devel at lists.lustre.org >>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From john.suykerbuyk at seagate.com Fri Jun 12 22:49:54 2015 From: john.suykerbuyk at seagate.com (John Suykerbuyk) Date: Fri, 12 Jun 2015 16:49:54 -0600 Subject: [lustre-devel] lustre design docs In-Reply-To: References: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> Message-ID: Can you guys point me to where I should create my Lustre Quick Start Guide (on KVM)? It's my hope that someone will be able to take this and a machine capable of hosting KVM virtual machines, and without anything but the publicly accessible repositories, assemble and play around with a small (3 node) Lustre virtual cluster. - John "S" On Fri, Jun 12, 2015 at 3:53 PM, Dilger, Andreas wrote: > I agree - there are a lot of documents spread across many places (old > wiki, new wiki, opensfs wiki, HPDD wiki, old CVS "lustre-doc" repo, etc). > Just getting those into a central location would be a good start. > > Obviously many of those documents are outdated, but I think even those > would be valuable as long as it is clear at the top of the document what > state it is in (e.g. having the date of origin and a description of the > status like obsolete, stale, useful, up-to-date, etc). > > I think Richard has been uploading some of our more recent design docs to > the new wiki, so that would be as good a place to start as any. > > Cheers, Andreas > > On 2015/06/12, 3:04 PM, "Justin Miller" wrote: > > >I think a central document repository is a good idea, and would be a > >valuable asset. The plan you outline to collect the documents and > >metadata first and then convert the most useful documents to a > >maintainable format makes a lot of sense. In addition to the benefits you > >identify, it may also allow for the collection of some interesting > >metrics. > > > >I¹d be happy to help with this project. > > > >- Justin Miller > > > > > >On 5/20/15, 1:06 PM, "lustre-devel on behalf of Vitaly Fertman" > > >vitaly.fertman at seagate.com> wrote: > > > >>Hi All, > >> > >>there was an idea to publish existing design docs on opensfs wiki. > >>is centralised design repository interesting at all? > >> > >>currently the existing designs are not in the wiki format, mostly pdf, > >>so this is > >>not an ideal doc repository we want to have: not changeable, not > >>maintainable, > >>could be outdated, etc, but could be published very quickly. > >> > >>however, this is not the final step but just a beginning. at the same > >>time, we may get > >>some benefits immediately: > >>- all the docs are gathered in one centralised place, faster doc search; > >>- the fully documented product (although maybe not very up-to-date > >>initially) ‹ > >>attractive for many readers, especially newbies; > >>- a quick jump to unknown code having a design, faster than reading the > >>source code; > >> > >>after that, having these docs already published, next steps could be: > >>- docs to be split on those which are to be maintained and left > >>untouched; > >>- a procedure of converting to be maintained docs to wiki format could > >>be organised; > >>- a procedure of updating converted docs to be organised; > >>etc. > >> > >>would be valuable? thoughts? > >> > >>‹ > >>Vitaly? > >>_______________________________________________ > >>lustre-devel mailing list > >>lustre-devel at lists.lustre.org > >>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > >_______________________________________________ > >lustre-devel mailing list > >lustre-devel at lists.lustre.org > >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > > > > Cheers, Andreas > -- > Andreas Dilger > > Lustre Software Architect > Intel High Performance Data Division > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Fri Jun 12 23:33:49 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Fri, 12 Jun 2015 16:33:49 -0700 Subject: [lustre-devel] KVM Quick Start Guide In-Reply-To: References: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> Message-ID: <557B6C5D.5000904@llnl.gov> Are you asking us to pick a title for you? How about: https://wiki.lustre.org/KVM_Quick_Start_Guide Chris On 06/12/2015 03:49 PM, John Suykerbuyk wrote: > Can you guys point me to where I should create my Lustre Quick Start > Guide (on KVM)? > > It's my hope that someone will be able to take this and a machine > capable of hosting KVM virtual machines, and without anything but the > publicly accessible repositories, assemble and play around with a small > (3 node) Lustre virtual cluster. > > - John "S" From morrone2 at llnl.gov Fri Jun 12 23:35:16 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Fri, 12 Jun 2015 16:35:16 -0700 Subject: [lustre-devel] KVM Quick Start Guide In-Reply-To: <557B6C5D.5000904@llnl.gov> References: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> <557B6C5D.5000904@llnl.gov> Message-ID: <557B6CB4.1080801@llnl.gov> Whoops, I put an "s" in there. I meant: http://wiki.lustre.org/KVM_Quick_Start_Guide On 06/12/2015 04:33 PM, Christopher J. Morrone wrote: > Are you asking us to pick a title for you? How about: > > https://wiki.lustre.org/KVM_Quick_Start_Guide > > Chris > > On 06/12/2015 03:49 PM, John Suykerbuyk wrote: >> Can you guys point me to where I should create my Lustre Quick Start >> Guide (on KVM)? >> >> It's my hope that someone will be able to take this and a machine >> capable of hosting KVM virtual machines, and without anything but the >> publicly accessible repositories, assemble and play around with a small >> (3 node) Lustre virtual cluster. >> >> - John "S" > > . > From colin.faber at seagate.com Tue Jun 16 15:02:05 2015 From: colin.faber at seagate.com (Colin Faber) Date: Tue, 16 Jun 2015 09:02:05 -0600 Subject: [lustre-devel] HSM phase 2 HLD / Roadmap? Message-ID: Hi Folks, Does anyone recall if Lustre HSM phase 2 documentation or road map was ever produced / published anywhere? -cf -------------- next part -------------- An HTML attachment was scrubbed... URL: From aurelien.degremont at cea.fr Tue Jun 16 15:08:54 2015 From: aurelien.degremont at cea.fr (DEGREMONT Aurelien) Date: Tue, 16 Jun 2015 17:08:54 +0200 Subject: [lustre-devel] HSM phase 2 HLD / Roadmap? In-Reply-To: References: Message-ID: <55803C06.4080003@cea.fr> Le 16/06/2015 17:02, Colin Faber a écrit : > Hi Folks, > > Does anyone recall if Lustre HSM phase 2 documentation or road map was > ever produced / published anywhere? AFAICR there never was a real official content for HSM phase 2, just ideas/wish list. As a consequence, no road map was done. Aurélien -------------- next part -------------- An HTML attachment was scrubbed... URL: From colin.faber at seagate.com Tue Jun 16 15:10:02 2015 From: colin.faber at seagate.com (Colin Faber) Date: Tue, 16 Jun 2015 09:10:02 -0600 Subject: [lustre-devel] HSM phase 2 HLD / Roadmap? In-Reply-To: <55803C06.4080003@cea.fr> References: <55803C06.4080003@cea.fr> Message-ID: Ah yes, This is what I thought as well, I just could not remember. Thanks for reminding me! -cf On Tue, Jun 16, 2015 at 9:08 AM, DEGREMONT Aurelien < aurelien.degremont at cea.fr> wrote: > Le 16/06/2015 17:02, Colin Faber a écrit : > > Hi Folks, > > Does anyone recall if Lustre HSM phase 2 documentation or road map was > ever produced / published anywhere? > > AFAICR there never was a real official content for HSM phase 2, just > ideas/wish list. As a consequence, no road map was done. > > > Aurélien > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.dilger at intel.com Tue Jun 16 15:21:58 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 16 Jun 2015 15:21:58 +0000 Subject: [lustre-devel] HSM phase 2 HLD / Roadmap? In-Reply-To: <55803C06.4080003@cea.fr> References: <55803C06.4080003@cea.fr> Message-ID: I think there are a few features that would be of interest for HSM improvement. * optimization of RobinHood database/POSIX copytool * better integration with DNE * partial file restore using composite files (http://wiki.opensfs.org/images/e/e4/LayoutEnhancementDesign_HighLevelDesig n.pdf) * change HSM to use LOV EA layout instead of dedicated xattr * allowing a larger HSM archive ID (e.g. 128-bit UUID) so it can be used as the primary archive identifier instead of Lustre FID * archive/restore of directory trees from the MDT as tarballs * allow release/restore of space from the MDT * would be needed for handling Data-on-MDT files Note that we don't have any plans to work on this, just listing some ideas percolating in my brain. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division On 2015/06/16, 9:08 AM, "DEGREMONT Aurelien" wrote: >Le 16/06/2015 17:02, Colin Faber a écrit : > > >Hi Folks, > >Does anyone recall if Lustre HSM phase 2 documentation or road map was >ever produced / published anywhere? > > > >AFAICR there never was a real official content for HSM phase 2, just >ideas/wish list. As a consequence, no road map was done. > > >Aurélien From paf at cray.com Tue Jun 16 15:28:53 2015 From: paf at cray.com (Patrick Farrell) Date: Tue, 16 Jun 2015 10:28:53 -0500 Subject: [lustre-devel] HSM phase 2 HLD / Roadmap? In-Reply-To: References: <55803C06.4080003@cea.fr> Message-ID: <558040B5.2050609@cray.com> Andreas, Could you expound on "Better integration with DNE"? I'm not immediately clear on what that might mean. Thanks, - Patrick On 06/16/2015 10:21 AM, Dilger, Andreas wrote: > I think there are a few features that would be of interest for HSM > improvement. > > * optimization of RobinHood database/POSIX copytool > * better integration with DNE > * partial file restore using composite files > (http://wiki.opensfs.org/images/e/e4/LayoutEnhancementDesign_HighLevelDesig > n.pdf) > * change HSM to use LOV EA layout instead of dedicated xattr > * allowing a larger HSM archive ID (e.g. 128-bit UUID) so it can be > used as the primary archive identifier instead of Lustre FID > * archive/restore of directory trees from the MDT as tarballs > * allow release/restore of space from the MDT > * would be needed for handling Data-on-MDT files > > Note that we don't have any plans to work on this, just listing some ideas > percolating in my brain. > > > Cheers, Andreas From andreas.dilger at intel.com Tue Jun 16 16:15:09 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 16 Jun 2015 16:15:09 +0000 Subject: [lustre-devel] HSM phase 2 HLD / Roadmap? In-Reply-To: <558040B5.2050609@cray.com> References: <55803C06.4080003@cea.fr> <558040B5.2050609@cray.com> Message-ID: On 2015/06/16, 9:28 AM, "Patrick Farrell" wrote: >Andreas, > >Could you expound on "Better integration with DNE"? I'm not immediately >clear on what that might mean. I was thinking that the current DNE support is still using a single RBH database fed by multiple ChangeLogs (one from each MDT), which doesn't scale very well. That said, I guess it would be possible to have a single parallel MySQL database that scales horizontally, so the scaling would be independent of the number of MDTs. Maybe this one should be dropped from the list, or just be considered part of the "optimize RBH database". Cheers, Andreas >Thanks, >- Patrick >On 06/16/2015 10:21 AM, Dilger, Andreas wrote: >> I think there are a few features that would be of interest for HSM >> improvement. >> >> * optimization of RobinHood database/POSIX copytool >> * better integration with DNE >> * partial file restore using composite files >> >>(http://wiki.opensfs.org/images/e/e4/LayoutEnhancementDesign_HighLevelDes >>ig >> n.pdf) >> * change HSM to use LOV EA layout instead of dedicated xattr >> * allowing a larger HSM archive ID (e.g. 128-bit UUID) so it can be >> used as the primary archive identifier instead of Lustre FID >> * archive/restore of directory trees from the MDT as tarballs >> * allow release/restore of space from the MDT >> * would be needed for handling Data-on-MDT files >> >> Note that we don't have any plans to work on this, just listing some >>ideas >> percolating in my brain. >> >> >> Cheers, Andreas > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From paf at cray.com Tue Jun 16 20:23:15 2015 From: paf at cray.com (Patrick Farrell) Date: Tue, 16 Jun 2015 15:23:15 -0500 Subject: [lustre-devel] Lock ahead v1 Message-ID: <558085B3.1040400@cray.com> Hello, I’ve been hard at work on lock ahead for some time, and there's been a notable change in the design. (I’m not going to recap lock ahead here – If you’d like background, please check out the slides and/or video of my LUG talk: http://cdn.opensfs.org/wp-content/uploads/2015/04/Shared-File-Performance-in-Lustre_Farrell.pdf ; http://youtu.be/ITfZfV5QzIs ) I'm emailing here primarily to explain the change for those reviewing the patch (http://review.whamcloud.com/#/c/13564/). It has proved extremely difficult to make blocking asynchronous lock requests, which I originally wanted. If the lock requests could be blocking, then they could clear out existing locks on the file. However, there are a number of problems with asynchronous blocking requests, some of which I detailed in emails to this list. With help from Jinshan, I have an idea what to do to fix them, but the changes are significant and, it turns out, not really necessary for lock ahead. Here's why: The main problem with non-blocking lock requests is they will not clear out existing locks, so if there are any on the file, we will not get lock ahead locks granted. To avoid this situation, we will have the library take and release a (blocking) group lock when it first opens the file. This will clear out any existing locks on the file, making it ‘clean’ for the lock ahead requests. This (mostly) means we don't need blocking lock ahead requests. The lock ahead writing process for writing out a large file, then, looks like this: OPEN, GROUP_LOCK, GROUP_UNLOCK, LOCK_AHEAD (n blocks ahead), WRITE, WRITE, WRITE … [track position of writes (IE, number of lock ahead locks remaining ahead of the IO), when lock ahead count is small—>] LOCK_AHEAD (n blocks ahead), WRITE, WRITE, WRITE… Etc. This also helps keep the lock count manageable, which avoids some performance issues. However, we need one more thing: Imagine if lock ahead locks are not created of the IO (due to raciness) or they are cancelled by a request from a node that is not part of the collective IO (for example, a user tries to read the file during the IO). In either case, the lock which results will be expanded normally. So it's possible for that lock to be extended to cover the rest of the file, and so it will block future lock ahead requests. That lock will be cancelled when a read or write request happens in the range covered by that lock, but that read/write request will be expanded as well - And we return to handing the lock back and forth between clients. The way to avoid this is to turn off lock expansion for anyone who is supposed to be using lock ahead locks. Their IO requests will normally use the lock ahead locks provided for them, but if the lock ahead locks aren't available (for reasons described above), the locks for these requests will not be expanded. This means that losing a race between IO and the lock ahead lock on a particular lock ahead request (or entire set of lock ahead requests) will never create a large lock, which would block future lock ahead requests. Additionally, if lock ahead is interrupted by a request from another client (preventing lock ahead requests by creating a large lock), the 'real' IO requests from the lock ahead clients will eventually cancel that large lock. Since the locks for those requests aren't expanded, the next set of lock ahead requests (which are out ahead of the IO) will work. Effectively, this means that if lock ahead is interrupted by a competing request or if it fails the race to be ready in time, it can avoid returning to the pathological case. Code implementing lock and this other ioctl to disable expansion is up for review here: http://review.whamcloud.com/#/c/13564/ The current version is essentially 'code complete' and ready for review. - Patrick Farrell From thomas.leibovici at cea.fr Wed Jun 17 08:08:28 2015 From: thomas.leibovici at cea.fr (LEIBOVICI Thomas) Date: Wed, 17 Jun 2015 10:08:28 +0200 Subject: [lustre-devel] HSM phase 2 HLD / Roadmap? In-Reply-To: References: <55803C06.4080003@cea.fr> <558040B5.2050609@cray.com> Message-ID: <55812AFC.1050405@cea.fr> On 06/16/15 18:15, Dilger, Andreas wrote: > On 2015/06/16, 9:28 AM, "Patrick Farrell" wrote: > >> Andreas, >> >> Could you expound on "Better integration with DNE"? I'm not immediately >> clear on what that might mean. > I was thinking that the current DNE support is still using a single RBH > database fed by multiple ChangeLogs (one from each MDT), which doesn't > scale very well. That said, I guess it would be possible to have a single > parallel MySQL database that scales horizontally, so the scaling would be > independent of the number of MDTs. > > Maybe this one should be dropped from the list, or just be considered part > of the "optimize RBH database". > > Cheers, Andreas AFAIK, there are other aspects of DNE that HSM wouldn't support: HSM does not currently support striped directories (DNE phase 2) in particular the volatile file used for "restore" operations wouldn't be properly located on the right MDT. Thomas >> Thanks, >> - Patrick >> On 06/16/2015 10:21 AM, Dilger, Andreas wrote: >>> I think there are a few features that would be of interest for HSM >>> improvement. >>> >>> * optimization of RobinHood database/POSIX copytool >>> * better integration with DNE >>> * partial file restore using composite files >>> >>> (http://wiki.opensfs.org/images/e/e4/LayoutEnhancementDesign_HighLevelDes >>> ig >>> n.pdf) >>> * change HSM to use LOV EA layout instead of dedicated xattr >>> * allowing a larger HSM archive ID (e.g. 128-bit UUID) so it can be >>> used as the primary archive identifier instead of Lustre FID >>> * archive/restore of directory trees from the MDT as tarballs >>> * allow release/restore of space from the MDT >>> * would be needed for handling Data-on-MDT files >>> >>> Note that we don't have any plans to work on this, just listing some >>> ideas >>> percolating in my brain. >>> >>> >>> Cheers, Andreas >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> > > Cheers, Andreas From john.suykerbuyk at seagate.com Fri Jun 19 16:19:19 2015 From: john.suykerbuyk at seagate.com (John Suykerbuyk) Date: Fri, 19 Jun 2015 10:19:19 -0600 Subject: [lustre-devel] KVM Quick Start Guide In-Reply-To: <557B6CB4.1080801@llnl.gov> References: <69BD0579-A188-4012-8926-3F55CF5E1BF9@seagate.com> <9EE73FB1-18B8-4ADC-86BE-1C059358F798@cray.com> <557B6C5D.5000904@llnl.gov> <557B6CB4.1080801@llnl.gov> Message-ID: I've got my document ready to publish, but am still waiting on my account request to be accepted. Is there someone I can (politely) nudge? - John "S" On Fri, Jun 12, 2015 at 5:35 PM, Christopher J. Morrone wrote: > Whoops, I put an "s" in there. I meant: > > http://wiki.lustre.org/KVM_Quick_Start_Guide > > On 06/12/2015 04:33 PM, Christopher J. Morrone wrote: > >> Are you asking us to pick a title for you? How about: >> >> https://wiki.lustre.org/KVM_Quick_Start_Guide >> >> Chris >> >> On 06/12/2015 03:49 PM, John Suykerbuyk wrote: >> >>> Can you guys point me to where I should create my Lustre Quick Start >>> Guide (on KVM)? >>> >>> It's my hope that someone will be able to take this and a machine >>> capable of hosting KVM virtual machines, and without anything but the >>> publicly accessible repositories, assemble and play around with a small >>> (3 node) Lustre virtual cluster. >>> >>> - John "S" >>> >> >> . >> >> > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paf at cray.com Mon Jun 22 15:46:15 2015 From: paf at cray.com (Patrick Farrell) Date: Mon, 22 Jun 2015 10:46:15 -0500 Subject: [lustre-devel] Fwd: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> References: <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> Message-ID: <55882DC7.6060802@cray.com> Question for lustre-devel... Isn't this the opposite of the style that we're currently trying to use in Gerrit submissions? Is my memory faulty? -------- Original Message -------- Subject: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure Date: Sat, 20 Jun 2015 18:58:59 +0200 From: Julia Lawall To: Oleg Drokin CC: , Greg Kroah-Hartman , , , !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall --- drivers/staging/lustre/lustre/fid/fid_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -u -p a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *o int rc; cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS); - if (cli->cl_seq == NULL) + if (!cli->cl_seq) return -ENOMEM; prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS); - if (prefix == NULL) { + if (!prefix) { rc = -ENOMEM; goto out_free_seq; } _______________________________________________ HPDD-discuss mailing list HPDD-discuss at lists.01.org https://lists.01.org/mailman/listinfo/hpdd-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From simmonsja at ornl.gov Mon Jun 22 17:18:53 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Mon, 22 Jun 2015 17:18:53 +0000 Subject: [lustre-devel] Fwd: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <55882DC7.6060802@cray.com> References: <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <55882DC7.6060802@cray.com> Message-ID: >Question for lustre-devel... Isn't this the opposite of the style that we're currently trying to use in Gerrit submissions? Is my memory faulty? You are correct. Is this change really necessary? I will respone shortly. -------- Original Message -------- Subject: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure Date: Sat, 20 Jun 2015 18:58:59 +0200 From: Julia Lawall To: Oleg Drokin CC: , Greg Kroah-Hartman , , , !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall --- drivers/staging/lustre/lustre/fid/fid_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -u -p a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *o int rc; cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS); - if (cli->cl_seq == NULL) + if (!cli->cl_seq) return -ENOMEM; prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS); - if (prefix == NULL) { + if (!prefix) { rc = -ENOMEM; goto out_free_seq; } _______________________________________________ HPDD-discuss mailing list HPDD-discuss at lists.01.org https://lists.01.org/mailman/listinfo/hpdd-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From simmonsja at ornl.gov Mon Jun 22 17:27:03 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Mon, 22 Jun 2015 17:27:03 +0000 Subject: [lustre-devel] [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure Message-ID: <556d2f2088404e09aac1f0a57767cea5@EXCHCS32.ornl.gov> Is this change a hard requirement? Currently the lustre code standard in our development tree is the opposite policy. -------- Original Message -------- Subject: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure Date: Sat, 20 Jun 2015 18:58:59 +0200 From: Julia Lawall To: Oleg Drokin CC: , Greg Kroah-Hartman , , , !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall --- drivers/staging/lustre/lustre/fid/fid_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -u -p a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *o int rc; cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS); - if (cli->cl_seq == NULL) + if (!cli->cl_seq) return -ENOMEM; prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS); - if (prefix == NULL) { + if (!prefix) { rc = -ENOMEM; goto out_free_seq; } _______________________________________________ HPDD-discuss mailing list HPDD-discuss at lists.01.org https://lists.01.org/mailman/listinfo/hpdd-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From gregkh at linuxfoundation.org Mon Jun 22 18:03:06 2015 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman (gregkh@linuxfoundation.org)) Date: Mon, 22 Jun 2015 11:03:06 -0700 Subject: [lustre-devel] [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <556d2f2088404e09aac1f0a57767cea5@EXCHCS32.ornl.gov> References: <556d2f2088404e09aac1f0a57767cea5@EXCHCS32.ornl.gov> Message-ID: <20150622180306.GA20087@kroah.com> On Mon, Jun 22, 2015 at 05:27:03PM +0000, Simmons, James A. wrote: > > Is this change a hard requirement? Currently the lustre code standard in our development tree is the opposite policy. Please follow the kernel coding style rules. From andreas.dilger at intel.com Tue Jun 23 08:05:27 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 23 Jun 2015 08:05:27 +0000 Subject: [lustre-devel] Fwd: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <55882DC7.6060802@cray.com> References: <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <55882DC7.6060802@cray.com> Message-ID: <0375F388-1F59-45D5-AC14-B40037ED4F9C@intel.com> Yes, and IMHO this set of patches is not an improvement. Cheers, Andreas On Jun 22, 2015, at 08:46, Patrick Farrell > wrote: Question for lustre-devel... Isn't this the opposite of the style that we're currently trying to use in Gerrit submissions? Is my memory faulty? -------- Original Message -------- Subject: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure Date: Sat, 20 Jun 2015 18:58:59 +0200 From: Julia Lawall To: Oleg Drokin CC: , Greg Kroah-Hartman , , , !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall --- drivers/staging/lustre/lustre/fid/fid_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -u -p a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *o int rc; cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS); - if (cli->cl_seq == NULL) + if (!cli->cl_seq) return -ENOMEM; prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS); - if (prefix == NULL) { + if (!prefix) { rc = -ENOMEM; goto out_free_seq; } _______________________________________________ HPDD-discuss mailing list HPDD-discuss at lists.01.org https://lists.01.org/mailman/listinfo/hpdd-discuss _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From andreas.dilger at intel.com Tue Jun 23 08:25:05 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 23 Jun 2015 08:25:05 +0000 Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> Message-ID: On 2015/06/20, 10:58 AM, "Julia Lawall" wrote: >!x is more normal for kzalloc failure in the kernel. While "!x" might be more normal for kzalloc(), I don't see that as an improvement over explicitly checking against NULL, which is what kzalloc() and other memory-allocating functions return on error. I've found in the past that developers can introduce bugs when they treat return values as boolean when they really aren't. I'd prefer that the code is kept with explicit comparisons against NULL, as it is today. Most of the cases that are now using "!x" are from your previous patches. Cheers, Andreas >Signed-off-by: Julia Lawall > >--- > drivers/staging/lustre/lustre/fid/fid_request.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff -u -p a/drivers/staging/lustre/lustre/fid/fid_request.c >b/drivers/staging/lustre/lustre/fid/fid_request.c >--- a/drivers/staging/lustre/lustre/fid/fid_request.c >+++ b/drivers/staging/lustre/lustre/fid/fid_request.c >@@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *o > int rc; > > cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS); >- if (cli->cl_seq == NULL) >+ if (!cli->cl_seq) > return -ENOMEM; > > prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS); >- if (prefix == NULL) { >+ if (!prefix) { > rc = -ENOMEM; > goto out_free_seq; > } > > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From dan.carpenter at oracle.com Tue Jun 23 09:23:03 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 23 Jun 2015 12:23:03 +0300 Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> Message-ID: <20150623092303.GN28762@mwanda> On Tue, Jun 23, 2015 at 08:25:05AM +0000, Dilger, Andreas wrote: > I've found in the past that developers can introduce bugs when they treat > return values as boolean when they really aren't. I can imagine a bug like that where a function can return 0-2 and people do: if (ret) instead of: if (ret == 1) but that bug is something else besides pointers so it doesn't apply here. What someone should do is try to measure it scientifically where we flash some code on the screen and you have to press J for NULL and K for non-NULL and we time it to the hundredth of a second. I have a feeling that (NULL != foo) is the worst way to write it because of the double negative Yoda code. Yoda code is the most useless thing ever. I have actually measured this and we introduce about 2 = vs == bugs per year. It's probably less now that we have so many static checks against it. But people decided that Yoda code was a good idea based on their gut instead of using statistics and measurements and science. regards, dan carpenter From julia.lawall at lip6.fr Tue Jun 23 09:35:42 2015 From: julia.lawall at lip6.fr (Julia Lawall) Date: Tue, 23 Jun 2015 11:35:42 +0200 (CEST) Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <20150623092303.GN28762@mwanda> References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150623092303.GN28762@mwanda> Message-ID: On Tue, 23 Jun 2015, Dan Carpenter wrote: > On Tue, Jun 23, 2015 at 08:25:05AM +0000, Dilger, Andreas wrote: > > I've found in the past that developers can introduce bugs when they treat > > return values as boolean when they really aren't. > > I can imagine a bug like that where a function can return 0-2 and people > do: > > if (ret) > > instead of: > > if (ret == 1) > > but that bug is something else besides pointers so it doesn't apply > here. > > What someone should do is try to measure it scientifically where we > flash some code on the screen and you have to press J for NULL and K for > non-NULL and we time it to the hundredth of a second. I have a feeling > that (NULL != foo) is the worst way to write it because of the double > negative Yoda code. > > Yoda code is the most useless thing ever. I have actually measured this > and we introduce about 2 = vs == bugs per year. It's probably less now > that we have so many static checks against it. But people decided that > Yoda code was a good idea based on their gut instead of using statistics > and measurements and science. In 2007, Al Viro said (https://lkml.org/lkml/2007/7/27/103): Idiomatic form for "has allocation succeeded?" is neither "if (p != 0)" nor "if (p != NULL)". It's simply "if (p)". >From the point of view of looking at kernel code, x == NULL for the result of kmalloc etc looks verbose and distracting. julia From dan.carpenter at oracle.com Tue Jun 23 09:57:04 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 23 Jun 2015 12:57:04 +0300 Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150623092303.GN28762@mwanda> Message-ID: <20150623095704.GO28762@mwanda> Yes. I know Al's thoughts and kernel style. But Alan Cox and Andreas have both said they think (x == NULL) can help you avoid some kind of boolean vs pointer bugs. I've had co-workers who did massive seds changing !foo to foo == NULL on our code base. But I've never seen a real life example of a bug this fixes. To be honest, I've never seen a real life proof that (!foo) code is less buggy. I should look through the kbuild mailbox... Hm... But my other idea of setting up code style readability testing website is also a good one. Linux kernel style is based on Joe Perches finding that 80% of the code prefers one way or the other. That's a valid method for determining code style. I bet it normally picks the more readable style but it would be interesting to measure it more formally. regards, dan carpenter From julia.lawall at lip6.fr Tue Jun 23 10:51:45 2015 From: julia.lawall at lip6.fr (Julia Lawall) Date: Tue, 23 Jun 2015 12:51:45 +0200 (CEST) Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <20150623095704.GO28762@mwanda> References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150623092303.GN28762@mwanda> <20150623095704.GO28762@mwanda> Message-ID: On Tue, 23 Jun 2015, Dan Carpenter wrote: > Yes. I know Al's thoughts and kernel style. > > But Alan Cox and Andreas have both said they think (x == NULL) can help > you avoid some kind of boolean vs pointer bugs. I've had co-workers who > did massive seds changing !foo to foo == NULL on our code base. But > I've never seen a real life example of a bug this fixes. > > To be honest, I've never seen a real life proof that (!foo) code is less > buggy. I should look through the kbuild mailbox... Hm... But my other > idea of setting up code style readability testing website is also a good > one. > > Linux kernel style is based on Joe Perches finding that 80% of the code > prefers one way or the other. That's a valid method for determining > code style. I bet it normally picks the more readable style but it > would be interesting to measure it more formally. On today's linux-next, I find 3218 tests on the result of kmalloc etc using NULL and 14429 without, making 82% without. The complete semantic patch is shown below. julia @initialize:ocaml@ @@ let withnull = ref 0 let withoutnull = ref 0 @r1 disable is_null, isnt_null1 exists@ expression x,e; position p; statement S1,S2; @@ x = \(kmalloc\|kzalloc\|kcalloc\|devm_kmalloc\|devm_kzalloc\)(...) ... when != x = e when != &x if at p (<+...\(x == NULL\|x != NULL\|NULL == x\|NULL != x\)...+>) S1 else S2 @r2 disable not_ptr1, not_ptr2 exists@ expression x,e; position p; statement S1,S2; @@ x = \(kmalloc\|kzalloc\|kcalloc\|devm_kmalloc\|devm_kzalloc\)(...) ... when != x = e when != &x if at p (<+...\(!x\|x && ...\|x || ...\)...+>) S1 else S2 @script:ocaml@ _p << r1.p; @@ withnull := !withnull + 1 @script:ocaml@ _p << r2.p; @@ withoutnull := !withoutnull + 1 @finalize:ocaml@ @@ Printf.printf "withnull %d withoutnull %d\n" !withnull !withoutnull From joe at perches.com Tue Jun 23 22:03:45 2015 From: joe at perches.com (Joe Perches) Date: Tue, 23 Jun 2015 15:03:45 -0700 Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <20150623095704.GO28762@mwanda> References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150623092303.GN28762@mwanda> <20150623095704.GO28762@mwanda> Message-ID: <1435097025.2504.8.camel@perches.com> On Tue, 2015-06-23 at 12:57 +0300, Dan Carpenter wrote: > I've never seen a real life proof that (!foo) code is less > buggy. Nor have I. > I should look through the kbuild mailbox... Hm... But my other > idea of setting up code style readability testing website is also a good > one. > > Linux kernel style is based on Joe Perches finding that 80% of the code > prefers one way or the other. That's a valid method for determining > code style. I bet it normally picks the more readable style but it > would be interesting to measure it more formally. That might be hard to do well. A code readability testing website is going to be fundamentally biased by the experiences of the coder that is tested. Flashing code for millisecond type readability tests has more correlation to quantity of white to black than code content does of correctness to memorability. From joe at perches.com Tue Jun 23 22:11:23 2015 From: joe at perches.com (Joe Perches) Date: Tue, 23 Jun 2015 15:11:23 -0700 Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: <20150623092303.GN28762@mwanda> References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150623092303.GN28762@mwanda> Message-ID: <1435097483.2504.10.camel@perches.com> On Tue, 2015-06-23 at 12:23 +0300, Dan Carpenter wrote: > people decided that > Yoda code was a good idea based on their gut instead of using statistics > and measurements and science. I think that style exists because compilers disallow CONST = val assignment typos. From andreas.dilger at intel.com Wed Jun 24 14:48:47 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 24 Jun 2015 14:48:47 +0000 Subject: [lustre-devel] Lock ahead v1 In-Reply-To: <558085B3.1040400@cray.com> References: <558085B3.1040400@cray.com> Message-ID: Maybe I'm missing something, but it isn't clear why the non-lockahead lock wouldn't conflict with the locks granted by lockahead to prevent lock expansion that cancels the other locks? That would be my expectation, and would avoid the need to add a separate ioctl to disable lock expansion (which IMHO might cause problems in the future for this process). Cheers, Andreas On 2015/06/16, 2:23 PM, "Patrick Farrell" wrote: >Hello, > >I¹ve been hard at work on lock ahead for some time, and there's been a >notable change in the design. (I¹m not going to recap lock ahead here ­ >If you¹d like background, please check out the slides and/or video of my >LUG talk: >http://cdn.opensfs.org/wp-content/uploads/2015/04/Shared-File-Performance- >in-Lustre_Farrell.pdf >; http://youtu.be/ITfZfV5QzIs ) > >I'm emailing here primarily to explain the change for those reviewing >the patch (http://review.whamcloud.com/#/c/13564/). > >It has proved extremely difficult to make blocking asynchronous lock >requests, which I originally wanted. If the lock requests could be >blocking, then they could clear out existing locks on the file. However, >there are a number of problems with asynchronous blocking requests, some >of which I detailed in emails to this list. With help from Jinshan, I >have an idea what to do to fix them, but the changes are significant >and, it turns out, not really necessary for lock ahead. > >Here's why: > >The main problem with non-blocking lock requests is they will not clear >out existing locks, so if there are any on the file, we will not get >lock ahead locks granted. To avoid this situation, we will have the >library take and release a (blocking) group lock when it first opens the >file. This will clear out any existing locks on the file, making it >Œclean¹ for the lock ahead requests. This (mostly) means we don't need >blocking lock ahead requests. > >The lock ahead writing process for writing out a large file, then, looks >like this: >OPEN, GROUP_LOCK, GROUP_UNLOCK, LOCK_AHEAD (n blocks ahead), WRITE, >WRITE, WRITE Š [track position of writes (IE, number of lock ahead locks >remaining ahead of the IO), when lock ahead count is small‹>] LOCK_AHEAD >(n blocks ahead), WRITE, WRITE, WRITEŠ Etc. > >This also helps keep the lock count manageable, which avoids some >performance issues. > >However, we need one more thing: > >Imagine if lock ahead locks are not created of the IO (due to raciness) >or they are cancelled by a request from a node that is not part of the >collective IO (for example, a user tries to read the file during the >IO). In either case, the lock which results will be expanded normally. >So it's possible for that lock to be extended to cover the rest of the >file, and so it will block future lock ahead requests. That lock will be >cancelled when a read or write request happens in the range covered by >that lock, but that read/write request will be expanded as well - And we >return to handing the lock back and forth between clients. > >The way to avoid this is to turn off lock expansion for anyone who is >supposed to be using lock ahead locks. Their IO requests will normally >use the lock ahead locks provided for them, but if the lock ahead locks >aren't available (for reasons described above), the locks for these >requests will not be expanded. > >This means that losing a race between IO and the lock ahead lock on a >particular lock ahead request (or entire set of lock ahead requests) >will never create a large lock, which would block future lock ahead >requests. > >Additionally, if lock ahead is interrupted by a request from another >client (preventing lock ahead requests by creating a large lock), the >'real' IO requests from the lock ahead clients will eventually cancel >that large lock. Since the locks for those requests aren't expanded, the >next set of lock ahead requests (which are out ahead of the IO) will work. > >Effectively, this means that if lock ahead is interrupted by a competing >request or if it fails the race to be ready in time, it can avoid >returning to the pathological case. > >Code implementing lock and this other ioctl to disable expansion is up >for review here: >http://review.whamcloud.com/#/c/13564/ > >The current version is essentially 'code complete' and ready for review. > >- Patrick Farrell >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From simmonsja at ornl.gov Wed Jun 24 20:14:04 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 24 Jun 2015 20:14:04 +0000 Subject: [lustre-devel] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150623092303.GN28762@mwanda> <20150623095704.GO28762@mwanda> Message-ID: >> Yes. I know Al's thoughts and kernel style. >> >> But Alan Cox and Andreas have both said they think (x == NULL) can help >> you avoid some kind of boolean vs pointer bugs. I've had co-workers who >> did massive seds changing !foo to foo == NULL on our code base. But >> I've never seen a real life example of a bug this fixes. >> >> To be honest, I've never seen a real life proof that (!foo) code is less >> buggy. I should look through the kbuild mailbox... Hm... But my other >> idea of setting up code style readability testing website is also a good >> one. >> >> Linux kernel style is based on Joe Perches finding that 80% of the code >> prefers one way or the other. That's a valid method for determining >> code style. I bet it normally picks the more readable style but it >> would be interesting to measure it more formally. > >On today's linux-next, I find 3218 tests on the result of kmalloc etc >using NULL and 14429 without, making 82% without. The complete semantic >patch is shown below. Most people doing something a certain way is not a technical argument. Usually people do what they are taught. From most people's comments their seems to be no technical reason to us one over another. I do have one technical reason not to accept these patches. It is too easy to make a mistake and break things very badly. I don't think it is worth the risk for a non-hard requirement. From jinshan.xiong at intel.com Thu Jun 25 08:33:25 2015 From: jinshan.xiong at intel.com (Xiong, Jinshan) Date: Thu, 25 Jun 2015 08:33:25 +0000 Subject: [lustre-devel] Lock ahead v1 In-Reply-To: References: <558085B3.1040400@cray.com> Message-ID: <91F184C2-54C3-4BB5-B74E-1320C0C12F82@intel.com> If non-lockahead lock is expanded, it will be conflicted with any later enqueue attempt of lockahead locks, therefore lookahead is indeed turned off. Then the other clients will have to enqueue locks for I/O and then most likely take over that expanded lock, and so on. This will make lockahead useless. Please let me know if I missed something. Jinshan > On Jun 24, 2015, at 10:48 PM, Dilger, Andreas wrote: > > Maybe I'm missing something, but it isn't clear why the non-lockahead lock > wouldn't conflict with the locks granted by lockahead to prevent lock > expansion that cancels the other locks? That would be my expectation, and > would avoid the need to add a separate ioctl to disable lock expansion > (which IMHO might cause problems in the future for this process). > > Cheers, Andreas > > On 2015/06/16, 2:23 PM, "Patrick Farrell" wrote: > >> Hello, >> >> I¹ve been hard at work on lock ahead for some time, and there's been a >> notable change in the design. (I¹m not going to recap lock ahead here ­ >> If you¹d like background, please check out the slides and/or video of my >> LUG talk: >> http://cdn.opensfs.org/wp-content/uploads/2015/04/Shared-File-Performance- >> in-Lustre_Farrell.pdf >> ; http://youtu.be/ITfZfV5QzIs ) >> >> I'm emailing here primarily to explain the change for those reviewing >> the patch (http://review.whamcloud.com/#/c/13564/). >> >> It has proved extremely difficult to make blocking asynchronous lock >> requests, which I originally wanted. If the lock requests could be >> blocking, then they could clear out existing locks on the file. However, >> there are a number of problems with asynchronous blocking requests, some >> of which I detailed in emails to this list. With help from Jinshan, I >> have an idea what to do to fix them, but the changes are significant >> and, it turns out, not really necessary for lock ahead. >> >> Here's why: >> >> The main problem with non-blocking lock requests is they will not clear >> out existing locks, so if there are any on the file, we will not get >> lock ahead locks granted. To avoid this situation, we will have the >> library take and release a (blocking) group lock when it first opens the >> file. This will clear out any existing locks on the file, making it >> Œclean¹ for the lock ahead requests. This (mostly) means we don't need >> blocking lock ahead requests. >> >> The lock ahead writing process for writing out a large file, then, looks >> like this: >> OPEN, GROUP_LOCK, GROUP_UNLOCK, LOCK_AHEAD (n blocks ahead), WRITE, >> WRITE, WRITE Š [track position of writes (IE, number of lock ahead locks >> remaining ahead of the IO), when lock ahead count is small‹>] LOCK_AHEAD >> (n blocks ahead), WRITE, WRITE, WRITEŠ Etc. >> >> This also helps keep the lock count manageable, which avoids some >> performance issues. >> >> However, we need one more thing: >> >> Imagine if lock ahead locks are not created of the IO (due to raciness) >> or they are cancelled by a request from a node that is not part of the >> collective IO (for example, a user tries to read the file during the >> IO). In either case, the lock which results will be expanded normally. >> So it's possible for that lock to be extended to cover the rest of the >> file, and so it will block future lock ahead requests. That lock will be >> cancelled when a read or write request happens in the range covered by >> that lock, but that read/write request will be expanded as well - And we >> return to handing the lock back and forth between clients. >> >> The way to avoid this is to turn off lock expansion for anyone who is >> supposed to be using lock ahead locks. Their IO requests will normally >> use the lock ahead locks provided for them, but if the lock ahead locks >> aren't available (for reasons described above), the locks for these >> requests will not be expanded. >> >> This means that losing a race between IO and the lock ahead lock on a >> particular lock ahead request (or entire set of lock ahead requests) >> will never create a large lock, which would block future lock ahead >> requests. >> >> Additionally, if lock ahead is interrupted by a request from another >> client (preventing lock ahead requests by creating a large lock), the >> 'real' IO requests from the lock ahead clients will eventually cancel >> that large lock. Since the locks for those requests aren't expanded, the >> next set of lock ahead requests (which are out ahead of the IO) will work. >> >> Effectively, this means that if lock ahead is interrupted by a competing >> request or if it fails the race to be ready in time, it can avoid >> returning to the pathological case. >> >> Code implementing lock and this other ioctl to disable expansion is up >> for review here: >> http://review.whamcloud.com/#/c/13564/ >> >> The current version is essentially 'code complete' and ready for review. >> >> - Patrick Farrell >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> > > > Cheers, Andreas > -- > Andreas Dilger > > Lustre Software Architect > Intel High Performance Data Division > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From paf at cray.com Thu Jun 25 20:13:16 2015 From: paf at cray.com (Patrick Farrell) Date: Thu, 25 Jun 2015 15:13:16 -0500 Subject: [lustre-devel] Lock ahead v1 In-Reply-To: <91F184C2-54C3-4BB5-B74E-1320C0C12F82@intel.com> References: <558085B3.1040400@cray.com> <91F184C2-54C3-4BB5-B74E-1320C0C12F82@intel.com> Message-ID: <558C60DC.6010805@cray.com> Jinshan, That's exactly what I'm suggesting. :) Andreas, I think you're asking why is that lock expanded, since there would usually be other lock ahead locks - I'll try to draw this out. Pretend a file is divided in to equal size extents. Each letter is a lock, a letter with _ _ _ _ indicates a lock on more than one extent. A single larger lock looks like this: A _ _ _ _ _ _ _ A set of lock ahead locks looks like this: A B C D E F G H I believe you're saying that if, for example, the race on lock E was lost, the resulting non lock-ahead lock request would not expand, because it would be blocked by F. That's clearly correct, and wouldn't cause any problems for future lock ahead requests. The suggestion is, essentially, that it might happen for lock H (or perhaps the race for F could be lost so badly the I/O wins out over lock requests F, G, and H), in which case we get this: A B C F E F F G H _ _ _ _ _ _ _ _ [... max size] So lock ahead requests I, J, K, etc are blocked by this lock. Eventually, the write corresponding to lock I arrives, and we get this: .... G H _ _ _ _ _ _ [... max size] I It conflicts with lock H, then we get ([ ] is part of the file with no lock): .... G [ ] I _ _ _ _ _ _ [... max size] And then we begin handing the expanded lock back and forth, blocking lock ahead all the while. This is not completely theoretical - With lower lock ahead counts (IE, number of locks taken ahead of the I/O), we sometimes saw this behavior in our testing. Our testing showed that turning up the count of locks taken ahead makes this less likely, but that drives up lock count, which is generally undesirable. Also, this does not cover the case of someone else reading the full file, fx with cat. In that case, the normal lock expansion followed by lock exchange behavior would take over completely. About causing future problems for the process using that file descriptor: The idea is that this usage is limited to a library, which knows it has done something odd to the file descriptor (which will certainly cause performance problems for normal I/O). So, if the library wants to do other I/O, it opens a new file descriptor for that purpose. - Patrick On 06/25/2015 03:33 AM, Xiong, Jinshan wrote: > If non-lockahead lock is expanded, it will be conflicted with any later enqueue attempt of lockahead locks, therefore lookahead is indeed turned off. Then the other clients will have to enqueue locks for I/O and then most likely take over that expanded lock, and so on. This will make lockahead useless. > > Please let me know if I missed something. > > Jinshan > >> On Jun 24, 2015, at 10:48 PM, Dilger, Andreas wrote: >> >> Maybe I'm missing something, but it isn't clear why the non-lockahead lock >> wouldn't conflict with the locks granted by lockahead to prevent lock >> expansion that cancels the other locks? That would be my expectation, and >> would avoid the need to add a separate ioctl to disable lock expansion >> (which IMHO might cause problems in the future for this process). >> >> Cheers, Andreas >> >> On 2015/06/16, 2:23 PM, "Patrick Farrell" wrote: >> >>> Hello, >>> >>> I¹ve been hard at work on lock ahead for some time, and there's been a >>> notable change in the design. (I¹m not going to recap lock ahead here ­ >>> If you¹d like background, please check out the slides and/or video of my >>> LUG talk: >>> http://cdn.opensfs.org/wp-content/uploads/2015/04/Shared-File-Performance- >>> in-Lustre_Farrell.pdf >>> ; http://youtu.be/ITfZfV5QzIs ) >>> >>> I'm emailing here primarily to explain the change for those reviewing >>> the patch (http://review.whamcloud.com/#/c/13564/). >>> >>> It has proved extremely difficult to make blocking asynchronous lock >>> requests, which I originally wanted. If the lock requests could be >>> blocking, then they could clear out existing locks on the file. However, >>> there are a number of problems with asynchronous blocking requests, some >>> of which I detailed in emails to this list. With help from Jinshan, I >>> have an idea what to do to fix them, but the changes are significant >>> and, it turns out, not really necessary for lock ahead. >>> >>> Here's why: >>> >>> The main problem with non-blocking lock requests is they will not clear >>> out existing locks, so if there are any on the file, we will not get >>> lock ahead locks granted. To avoid this situation, we will have the >>> library take and release a (blocking) group lock when it first opens the >>> file. This will clear out any existing locks on the file, making it >>> Œclean¹ for the lock ahead requests. This (mostly) means we don't need >>> blocking lock ahead requests. >>> >>> The lock ahead writing process for writing out a large file, then, looks >>> like this: >>> OPEN, GROUP_LOCK, GROUP_UNLOCK, LOCK_AHEAD (n blocks ahead), WRITE, >>> WRITE, WRITE Š [track position of writes (IE, number of lock ahead locks >>> remaining ahead of the IO), when lock ahead count is small‹>] LOCK_AHEAD >>> (n blocks ahead), WRITE, WRITE, WRITEŠ Etc. >>> >>> This also helps keep the lock count manageable, which avoids some >>> performance issues. >>> >>> However, we need one more thing: >>> >>> Imagine if lock ahead locks are not created of the IO (due to raciness) >>> or they are cancelled by a request from a node that is not part of the >>> collective IO (for example, a user tries to read the file during the >>> IO). In either case, the lock which results will be expanded normally. >>> So it's possible for that lock to be extended to cover the rest of the >>> file, and so it will block future lock ahead requests. That lock will be >>> cancelled when a read or write request happens in the range covered by >>> that lock, but that read/write request will be expanded as well - And we >>> return to handing the lock back and forth between clients. >>> >>> The way to avoid this is to turn off lock expansion for anyone who is >>> supposed to be using lock ahead locks. Their IO requests will normally >>> use the lock ahead locks provided for them, but if the lock ahead locks >>> aren't available (for reasons described above), the locks for these >>> requests will not be expanded. >>> >>> This means that losing a race between IO and the lock ahead lock on a >>> particular lock ahead request (or entire set of lock ahead requests) >>> will never create a large lock, which would block future lock ahead >>> requests. >>> >>> Additionally, if lock ahead is interrupted by a request from another >>> client (preventing lock ahead requests by creating a large lock), the >>> 'real' IO requests from the lock ahead clients will eventually cancel >>> that large lock. Since the locks for those requests aren't expanded, the >>> next set of lock ahead requests (which are out ahead of the IO) will work. >>> >>> Effectively, this means that if lock ahead is interrupted by a competing >>> request or if it fails the race to be ready in time, it can avoid >>> returning to the pathological case. >>> >>> Code implementing lock and this other ioctl to disable expansion is up >>> for review here: >>> http://review.whamcloud.com/#/c/13564/ >>> >>> The current version is essentially 'code complete' and ready for review. >>> >>> - Patrick Farrell >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>> >> >> Cheers, Andreas >> -- >> Andreas Dilger >> >> Lustre Software Architect >> Intel High Performance Data Division >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From jsimmons at infradead.org Thu Jun 25 20:59:46 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 25 Jun 2015 16:59:46 -0400 Subject: [lustre-devel] [PATCH] staging:lustre: remove irq.h from socklnd.h Message-ID: <1435265986-10375-1-git-send-email-jsimmons@infradead.org> The header socklnd.h includes irq.h which is not need and doesn't exist in the OpenSFS lustre branch. Having irq.h in socklnd.h does break the build on the m68k platform. So we can safely remove it. Signed-off-by: James Simmons --- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 7125eb9..8a9d4a0 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -31,7 +31,6 @@ #define DEBUG_PORTAL_ALLOC #define DEBUG_SUBSYSTEM S_LND -#include #include #include #include -- 1.7.1 From geert at linux-m68k.org Wed Jun 24 12:37:51 2015 From: geert at linux-m68k.org (Geert Uytterhoeven) Date: Wed, 24 Jun 2015 14:37:51 +0200 Subject: [lustre-devel] [PATCH v4 4/9] staging:lustre: merge socklnd_lib-linux.h into socklnd.h In-Reply-To: <1434050295-10986-5-git-send-email-jsimmons@infradead.org> References: <1434050295-10986-1-git-send-email-jsimmons@infradead.org> <1434050295-10986-5-git-send-email-jsimmons@infradead.org> Message-ID: Hi James, On Thu, Jun 11, 2015 at 9:18 PM, James Simmons wrote: > From: John L. Hammond > > Originally socklnd_lib-linux.h contained linux specific > wrappers and defines but since the linux kernel is the > only supported platform now we can merge what little > remains in the header into socklnd.h. This is broken > out of the original patch 12932 that was merged to the > Intel/OpenSFS branch. > > Signed-off-by: John L. Hammond > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 > Reviewed-on: http://review.whamcloud.com/12932 > Reviewed-by: Isaac Huang > Reviewed-by: James Simmons > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 39 +++++++++- > .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.h | 86 -------------------- > .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 4 +- > 3 files changed, 40 insertions(+), 89 deletions(-) > delete mode 100644 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h > > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h > index 53275f9..7125eb9 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h > @@ -25,16 +25,40 @@ > * > */ > > +#ifndef _SOCKLND_SOCKLND_H_ > +#define _SOCKLND_SOCKLND_H_ > + > #define DEBUG_PORTAL_ALLOC > #define DEBUG_SUBSYSTEM S_LND > > -#include "socklnd_lib-linux.h" > +#include > +#include > +#include Including first causes a build failure for m68k/allmodconfig: arch/m68k/include/asm/irq.h:77:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void' arch/m68k/include/asm/irq.h:78:1: error: unknown type name 'atomic_t' arch/m68k/include/asm/irq.h:77:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void' arch/m68k/include/asm/irq.h:78:1: error: unknown type name 'atomic_t' http://kisskb.ellerman.id.au/kisskb/buildresult/12448922/ Fixing it inside arch/m68k/include/asm/irq.h might cause Include Hell, so perhaps you can just move the include below all includes? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From geert at linux-m68k.org Fri Jun 26 07:05:57 2015 From: geert at linux-m68k.org (Geert Uytterhoeven) Date: Fri, 26 Jun 2015 09:05:57 +0200 Subject: [lustre-devel] [PATCH] staging:lustre: remove irq.h from socklnd.h In-Reply-To: <1435265986-10375-1-git-send-email-jsimmons@infradead.org> References: <1435265986-10375-1-git-send-email-jsimmons@infradead.org> Message-ID: On Thu, Jun 25, 2015 at 10:59 PM, James Simmons wrote: > The header socklnd.h includes irq.h which is not need > and doesn't exist in the OpenSFS lustre branch. Having > irq.h in socklnd.h does break the build on the m68k > platform. So we can safely remove it. > > Signed-off-by: James Simmons Thanks, works fine on next-20150625! Tested-by: by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From oleg.drokin at intel.com Sat Jun 27 13:26:14 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Sat, 27 Jun 2015 13:26:14 +0000 Subject: [lustre-devel] lustre: broken/old urls in the code In-Reply-To: <558E5174.1050202@gmail.com> References: <558E5174.1050202@gmail.com> Message-ID: Hello! On Jun 27, 2015, at 3:32 AM, Xose Vazquez Perez wrote: > Hi, > > You should replace old and broken urls. Of the URLs you quoted the only five old URLs that are not working are: http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - this one is part of old standard GPL header. That copyright was bought by Oracle then by Xyratex and then by Seagate. We do not own it and we felt at the time we don't really have any rights to change it. That's why it stays like that. http://wiki.lustre.org/index.php/Architecture_-_Interoperability_fids_zfs - this does not seem to work indeed and we need to find where it was moved to. Same deal with arch.lustre.org http://www.xyratex.com/contact is no more and is part of Seagate now, but I guess it's part of come copyright header and so unchangeable all that easily? The rest seem to be working just fine. lustre.org is valid and is not old. Same with opensfs. whamcloud* is deprecated but the proper redirects are in place, so I guess we can change them to the new location. > > querida:/mnt/datos/kernel/linux/drivers/staging/lustre $ egrep -ir "http|ftp:" * -h | sort | uniq -c | sort -nr > 275 * This file is part of Lustre, http://www.lustre.org/ > 253 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf > 14 MODULE_AUTHOR("Sun Microsystems, Inc. "); > 10 * http://www.gnu.org/licenses/gpl-2.0.html > 6 * version 2 along with this program; If not, see http://www.gnu.org/licenses > 4 * Please visit http://www.xyratex.com/contact if you need additional > 2 * This file is part of Portals, http://www.sf.net/projects/sandiaportals/ > 2 See also http://wiki.lustre.org/ > 2 * http://www.gnu.org/licenses/gpl-2.0.txt > 2 * http://sourceforge.net/projects/sandiaportals/ > 1 * with this program. If not, see . > 1 * This file is part of Portals, http://www.sf.net/projects/lustre/ > 1 * This file is part of Lustre, http://www.lustre.org. > 1 * This file is part of Lustre, http://www.lustre.org > 1 OpenSFS website: http://lustre.opensfs.org/about/ > 1 LCONSOLE_INFO("Echo OBD driver; http://www.lustre.org/\n"); > 1 Intel HPDD wiki: https://wiki.hpdd.intel.com > 1 "inode=%lu/%u(%p) nrpages=%lu, see http://jira.whamcloud.com/browse/LU-118\n", > 1 * http://www.citi.umich.edu/techreports/reports/citi-tr-00-1.pdf > 1 * http://wiki.lustre.org/index.php/Architecture_-_Interoperability_fids_zfs > 1 https://downloads.hpdd.intel.com/public/lustre/latest-feature-release/ > 1 http://lustre.opensfs.org/download-lustre/ > 1 http://git.whamcloud.com/?p=fs/lustre-release.git;a=summary > 1 http://git.whamcloud.com/fs/lustre-release.git > 1 http://downloads.whamcloud.com/public/lustre/ > 1 * http://arch.lustre.org/index.php?title=Interoperability_fids_zfs#NEW.0 > 1 * http://arch.lustre.org/index.php?title=Interoperability_fids_zfs > 1 CWARN("Saw flags 0x%x and 0x%x in the same brw, please report this at http://bugs.whamcloud.com/\n", > 1 CERROR("%s went back in time (transno %lld was previously committed, server now claims %lld)! See https://bugzilla.lustre.org/show_bug.cgi?id=9646\n", > > -thanks- From julia.lawall at lip6.fr Sun Jun 28 06:52:46 2015 From: julia.lawall at lip6.fr (Julia Lawall) Date: Sun, 28 Jun 2015 08:52:46 +0200 (CEST) Subject: [lustre-devel] LIBCFS_ALLOC In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> Message-ID: It is not clear that all of the uses of LIBCFS_ALLOC really risk needing vmalloc. For example: lnet/klnds/socklnd/socklnd.c, function ksocknal_accept: ksock_connreq_t *cr; ... LIBCFS_ALLOC(cr, sizeof(*cr)); The definition of ksock_connreq_t is: typedef struct ksock_connreq { struct list_head ksncr_list; /* stash on ksnd_connd_connreqs */ lnet_ni_t *ksncr_ni; /* chosen NI */ struct socket *ksncr_sock; /* accepted socket */ } ksock_connreq_t; This looks like a very small structure. LIBCFS_ALLOC relies on a test on the size, which should be able to be compiled away. libcfs_kvzalloc on the other hand relies on the failure of kmalloc and so the test for that won't be compiled away. Does it matter? julia From dan.carpenter at oracle.com Sun Jun 28 21:54:08 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 29 Jun 2015 00:54:08 +0300 Subject: [lustre-devel] LIBCFS_ALLOC In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> Message-ID: <20150628215408.GG28762@mwanda> Yeah. You're right. Doing a vmalloc() when kmalloc() doesn't have even a tiny sliver of RAM isn't going to work. It's easier to use libcfs_kvzalloc() everywhere, but it's probably the wrong thing. regards, dan carpenter From linux at roeck-us.net Sat Jun 27 03:48:09 2015 From: linux at roeck-us.net (Guenter Roeck) Date: Fri, 26 Jun 2015 20:48:09 -0700 Subject: [lustre-devel] [PATCH] staging:lustre: remove irq.h from socklnd.h In-Reply-To: <1435265986-10375-1-git-send-email-jsimmons@infradead.org> References: <1435265986-10375-1-git-send-email-jsimmons@infradead.org> Message-ID: <20150627034809.GA3922@roeck-us.net> On Thu, Jun 25, 2015 at 04:59:46PM -0400, James Simmons wrote: > The header socklnd.h includes irq.h which is not need > and doesn't exist in the OpenSFS lustre branch. Having > irq.h in socklnd.h does break the build on the m68k > platform. So we can safely remove it. > > Signed-off-by: James Simmons The m68k build problem is now seen in mainline, and this patch fixes it. Tested-by: Guenter Roeck Guenter From simmonsja at ornl.gov Tue Jun 30 14:56:21 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Tue, 30 Jun 2015 14:56:21 +0000 Subject: [lustre-devel] LIBCFS_ALLOC In-Reply-To: <20150628215408.GG28762@mwanda> References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150628215408.GG28762@mwanda> Message-ID: >Yeah. You're right. Doing a vmalloc() when kmalloc() doesn't have even >a tiny sliver of RAM isn't going to work. It's easier to use >libcfs_kvzalloc() everywhere, but it's probably the wrong thing. The original reason we have the vmalloc water mark wasn't so much the issue of memory exhaustion but to handle the case of memory fragmentation. Some sites had after a extended period of time started to see failures of allocating even 32K using kmalloc. In our latest development branch we moved away from using a water mark to always try kmalloc first and if it fails then we try vmalloc. At ORNL we ran into severe performance issues when we entered vmalloc territory. It has been discussed before on what might replace vmalloc handling in the case of kmalloc fails but no solution has been worked out. From julia.lawall at lip6.fr Tue Jun 30 15:01:03 2015 From: julia.lawall at lip6.fr (Julia Lawall) Date: Tue, 30 Jun 2015 17:01:03 +0200 (CEST) Subject: [lustre-devel] LIBCFS_ALLOC In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150628215408.GG28762@mwanda> Message-ID: On Tue, 30 Jun 2015, Simmons, James A. wrote: > >Yeah. You're right. Doing a vmalloc() when kmalloc() doesn't have even > >a tiny sliver of RAM isn't going to work. It's easier to use > >libcfs_kvzalloc() everywhere, but it's probably the wrong thing. > > The original reason we have the vmalloc water mark wasn't so much the > issue of memory exhaustion but to handle the case of memory fragmentation. > Some sites had after a extended period of time started to see failures of > allocating even 32K using kmalloc. In our latest development branch we moved > away from using a water mark to always try kmalloc first and if it fails then we > try vmalloc. At ORNL we ran into severe performance issues when we entered > vmalloc territory. It has been discussed before on what might replace vmalloc > handling in the case of kmalloc fails but no solution has been worked out. OK, but if a structure contains only 4 words, would it be better to just use kzalloc? Or does it not matter? It would only save trying vmalloc in a case that it is guaranteed to fail, but if a structure with 4 words can't be allocatted, the system has other problems. Another argument is that kzalloc is a well known function that people and bug-finding tools understand, so it is better to use it whenever possible. Some of the other structures contain a lot more fields, as well as small arrays. They are probably acceptable for kzalloc too, but I wouldn't know the exact dividing line. julia From dan.carpenter at oracle.com Tue Jun 30 17:38:34 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 30 Jun 2015 20:38:34 +0300 Subject: [lustre-devel] LIBCFS_ALLOC In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> <20150628215408.GG28762@mwanda> Message-ID: <20150630173834.GQ28762@mwanda> All that you are saying is true and stuff that Julia and I have discussed before. For this call site though we are not allocating 32k, we're allocating 4 pointers so libcfs_kvzalloc() doesn't make sense. regards, dan carpenter From andreas.dilger at intel.com Tue Jun 30 21:26:43 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 30 Jun 2015 21:26:43 +0000 Subject: [lustre-devel] LIBCFS_ALLOC In-Reply-To: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr> Message-ID: On 2015/06/28, 12:52 AM, "Julia Lawall" wrote: >It is not clear that all of the uses of LIBCFS_ALLOC really risk needing >vmalloc. For example: > >lnet/klnds/socklnd/socklnd.c, function ksocknal_accept: > >ksock_connreq_t *cr; >... >LIBCFS_ALLOC(cr, sizeof(*cr)); > >The definition of ksock_connreq_t is: > >typedef struct ksock_connreq { > struct list_head ksncr_list; /* stash on ksnd_connd_connreqs */ > lnet_ni_t *ksncr_ni; /* chosen NI */ > struct socket *ksncr_sock; /* accepted socket */ >} ksock_connreq_t; > >This looks like a very small structure. > >LIBCFS_ALLOC relies on a test on the size, which should be able to be >compiled away. libcfs_kvzalloc on the other hand relies on the failure >of >kmalloc and so the test for that won't be compiled away. There are probably only a handful of places where trying vmalloc() even makes sense. In most cases, LIBCFS_ALLOC() can be replaced by a straight call to kmalloc() because the allocation size is small enough, and only a few need to use libcfs_kvzalloc(). Anything at PAGE_SIZE or less will either work with kmalloc() or it won't work at all. I do agree with James' comments that vmalloc() was needed for both very large allocations that can't be satisfied by kmalloc() at all, as well as smaller allocations (anything over a couple of pages) due to fragmentation of free pages after running for a long time. I think libcfs_kvzalloc() is at least as good as the size-based threshold used previously, since using kmalloc() is going to be faster than vmalloc() and would work better on 32-bit platforms with limited vmalloc() size. Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division