[PATCH 038/124] staging: lustre: osc: debug to match extent to brw RPC
From: Patrick FarrellCurrently, it's difficult to match brw RPCs to objects and extents from client logs. This patch adds a D_RPCTRACE debug message giving the necessary information. Signed-off-by: Patrick Farrell Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5531 Reviewed-on: http://review.whamcloud.com/11548 Reviewed-by: Alexey Lyashkov Reviewed-by: Ann Koehler Reviewed-by: Ryan Haasken Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_request.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 5cca2b6..d5d2963 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1419,6 +1419,11 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, INIT_LIST_HEAD(>aa_oaps); *reqp = req; + niobuf = req_capsule_client_get(pill, _NIOBUF_REMOTE); + CDEBUG(D_RPCTRACE, "brw rpc %p - object " DOSTID " offset %lld<>%lld\n", + req, POSTID(>o_oi), niobuf[0].rnb_offset, + niobuf[niocount - 1].rnb_offset + niobuf[niocount - 1].rnb_len); + return 0; out: -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 057/124] staging: lustre: statahead: ll_intent_drop_lock() called in spinlock
From: Lai Siyaoll_intent_drop_lock() may sleep, which should not be called inside spinlock. Signed-off-by: Lai Siyao Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2272 Reviewed-on: http://review.whamcloud.com/9665 Reviewed-by: Fan Yong Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/statahead.c | 24 -- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index d041720..5be955d 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -661,6 +661,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, struct ll_inode_info *lli = ll_i2info(dir); struct ll_statahead_info *sai = lli->lli_sai; struct sa_entry *entry = (struct sa_entry *)minfo->mi_cbdata; + __u64 handle = 0; bool wakeup; if (it_disposition(it, DISP_LOOKUP_NEG)) @@ -677,6 +678,21 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, CDEBUG(D_READA, "sa_entry %.*s rc %d\n", entry->se_qstr.len, entry->se_qstr.name, rc); + if (rc) { + ll_intent_release(it); + iput(dir); + kfree(minfo); + } else { + /* +* release ibits lock ASAP to avoid deadlock when statahead +* thread enqueues lock on parent in readdir and another +* process enqueues lock on child with parent lock held, eg. +* unlink. +*/ + handle = it->it_lock_handle; + ll_intent_drop_lock(it); + } + spin_lock(>lli_sa_lock); if (rc) { wakeup = __sa_make_ready(sai, entry, rc); @@ -689,8 +705,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, * for readpage and other tries to enqueue lock on child * with parent's lock held, for example: unlink. */ - entry->se_handle = it->it_lock_handle; - ll_intent_drop_lock(it); + entry->se_handle = handle; wakeup = !sa_has_callback(sai); list_add_tail(>se_list, >sai_interim_entries); } @@ -700,11 +715,6 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, wake_up(>sai_thread.t_ctl_waitq); spin_unlock(>lli_sa_lock); - if (rc) { - ll_intent_release(it); - iput(dir); - kfree(minfo); - } return rc; } -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 071/124] staging: lustre: obd: remove unused obd methods
From: John L. HammondRemove no longer used osc_packmd() and osc_getstripe(). Several ioctls cases that are no longer used are removed. Remove no longer used adjust_kms() infrastructure. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2785 Reviewed-on: http://review.whamcloud.com/8547 Reviewed-by: Jinshan Xiong Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h |3 - drivers/staging/lustre/lustre/include/obd_class.h | 13 -- drivers/staging/lustre/lustre/lov/lov_internal.h |2 - drivers/staging/lustre/lustre/lov/lov_merge.c | 39 -- drivers/staging/lustre/lustre/lov/lov_obd.c |1 - drivers/staging/lustre/lustre/mgc/mgc_request.c |2 - drivers/staging/lustre/lustre/osc/osc_request.c | 147 - 7 files changed, 0 insertions(+), 207 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 6eac63e..04a9b97 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -866,7 +866,6 @@ struct obd_ops { int (*unpackmd)(struct obd_export *exp, struct lov_stripe_md **mem_tgt, struct lov_mds_md *disk_src, int disk_len); - int (*preallocate)(struct lustre_handle *, u32 *req, u64 *ids); int (*create)(const struct lu_env *env, struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti); @@ -882,8 +881,6 @@ struct obd_ops { struct obd_info *oinfo); int (*getattr_async)(struct obd_export *exp, struct obd_info *oinfo, struct ptlrpc_request_set *set); - int (*adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm, - u64 size, int shrink); int (*preprw)(const struct lu_env *env, int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *remote, diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 3d081cf..3245952 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -1152,19 +1152,6 @@ static inline int obd_commitrw(const struct lu_env *env, int cmd, return rc; } -static inline int obd_adjust_kms(struct obd_export *exp, -struct lov_stripe_md *lsm, u64 size, -int shrink) -{ - int rc; - - EXP_CHECK_DT_OP(exp, adjust_kms); - EXP_COUNTER_INCREMENT(exp, adjust_kms); - - rc = OBP(exp->exp_obd, adjust_kms)(exp, lsm, size, shrink); - return rc; -} - static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void __user *uarg) { diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 12bd511..5ddaeda 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -134,8 +134,6 @@ static inline void lov_put_reqset(struct lov_request_set *set) /* lov_merge.c */ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid, struct lov_stripe_md *lsm, int stripeno, int *set); -int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, - u64 size, int shrink); int lov_merge_lvb_kms(struct lov_stripe_md *lsm, struct ost_lvb *lvb, __u64 *kms_place); diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index b9c9086..674af10 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -105,45 +105,6 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, return rc; } -/* Must be called under the lov_stripe_lock() */ -int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, - u64 size, int shrink) -{ - struct lov_oinfo *loi; - int stripe = 0; - __u64 kms; - - assert_spin_locked(>lsm_lock); - LASSERT(lsm->lsm_lock_owner == current_pid()); - - if (shrink) { - for (; stripe < lsm->lsm_stripe_count; stripe++) { - struct lov_oinfo *loi = lsm->lsm_oinfo[stripe]; - - kms = lov_size_to_stripe(lsm, size, stripe); - CDEBUG(D_INODE, - "stripe %d KMS %sing %llu->%llu\n", -
[PATCH 065/124] staging: lustre: obdclass: change lu_site->ls_purge_start to unsigned
From: Dmitry EreminChange the type accordant usage. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5577 Reviewed-on: http://review.whamcloud.com/12384 Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lu_object.h |2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 7b37cae..260643e 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -602,7 +602,7 @@ struct lu_site { /** * index of bucket on hash table while purging */ - intls_purge_start; + unsigned intls_purge_start; /** * Top-level device for this stack. */ diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index e284e5d..4395117 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -338,7 +338,7 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) struct cfs_hash_bd bd2; struct list_head dispose; int did_sth; - int start; + unsigned int start; int count; int bnr; unsigned int i; -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 042/124] staging: lustre: obd: change type of lmv_tgt_desc->ltd_idx to u32
From: Dmitry Ereminltd_idx is used as unsigned. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5577 Reviewed-on: http://review.whamcloud.com/11879 Reviewed-by: John L. Hammond Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h|2 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c |8 drivers/staging/lustre/lustre/lmv/lmv_obd.c|6 +++--- drivers/staging/lustre/lustre/lmv/lproc_lmv.c |2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 19230a9..4b72fb9 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -406,7 +406,7 @@ struct lov_obd { struct lmv_tgt_desc { struct obd_uuid ltd_uuid; struct obd_export *ltd_exp; - int ltd_idx; + u32 ltd_idx; struct mutexltd_fid_mutex; unsigned long ltd_active:1; /* target up for requests */ }; diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index f24848f..1952454 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -113,7 +113,7 @@ static int lmv_intent_remote(struct obd_export *exp, struct lookup_intent *it, } op_data->op_bias = MDS_CROSS_REF; - CDEBUG(D_INODE, "REMOTE_INTENT with fid="DFID" -> mds #%d\n", + CDEBUG(D_INODE, "REMOTE_INTENT with fid=" DFID " -> mds #%u\n", PFID(>mbo_fid1), tgt->ltd_idx); rc = md_intent_lock(tgt->ltd_exp, op_data, it, , cb_blocking, @@ -202,7 +202,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, goto cleanup; } - CDEBUG(D_INODE, "Revalidate slave "DFID" -> mds #%d\n", + CDEBUG(D_INODE, "Revalidate slave " DFID " -> mds #%u\n", PFID(), tgt->ltd_idx); if (req) { @@ -349,7 +349,7 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, return rc; } - CDEBUG(D_INODE, "OPEN_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%d\n", + CDEBUG(D_INODE, "OPEN_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%u\n", PFID(_data->op_fid1), PFID(_data->op_fid2), op_data->op_name, tgt->ltd_idx); @@ -427,7 +427,7 @@ static int lmv_intent_lookup(struct obd_export *exp, if (!fid_is_sane(_data->op_fid2)) fid_zero(_data->op_fid2); - CDEBUG(D_INODE, "LOOKUP_INTENT with fid1="DFID", fid2="DFID", name='%s' -> mds #%d lsm=%p lsm_magic=%x\n", + CDEBUG(D_INODE, "LOOKUP_INTENT with fid1=" DFID ", fid2=" DFID ", name='%s' -> mds #%u lsm=%p lsm_magic=%x\n", PFID(_data->op_fid1), PFID(_data->op_fid2), op_data->op_name ? op_data->op_name : "", tgt->ltd_idx, lsm, !lsm ? -1 : lsm->lsm_md_magic); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 208a44d..b852a65 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1836,7 +1836,7 @@ lmv_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, if (IS_ERR(tgt)) return PTR_ERR(tgt); - CDEBUG(D_INODE, "ENQUEUE '%s' on "DFID" -> mds #%d\n", + CDEBUG(D_INODE, "ENQUEUE '%s' on " DFID " -> mds #%u\n", LL_IT2STR(it), PFID(_data->op_fid1), tgt->ltd_idx); rc = md_enqueue(tgt->ltd_exp, einfo, policy, it, op_data, lockh, @@ -1864,7 +1864,7 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data, if (IS_ERR(tgt)) return PTR_ERR(tgt); - CDEBUG(D_INODE, "GETATTR_NAME for %*s on "DFID" -> mds #%d\n", + CDEBUG(D_INODE, "GETATTR_NAME for %*s on " DFID " -> mds #%u\n", op_data->op_namelen, op_data->op_name, PFID(_data->op_fid1), tgt->ltd_idx); @@ -2609,7 +2609,7 @@ try_next_stripe: if (rc != 0) return rc; - CDEBUG(D_INODE, "unlink with fid="DFID"/"DFID" -> mds #%d\n", + CDEBUG(D_INODE, "unlink with fid=" DFID "/" DFID " -> mds #%u\n", PFID(_data->op_fid1), PFID(_data->op_fid2), tgt->ltd_idx); rc = md_unlink(tgt->ltd_exp, op_data, request); diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c index d2316c0..20bbdfc 100644 ---
[PATCH 024/124] staging: lustre: remove RCU2HANDLE macro
From: John L. HammondRemove RCU2HANDLE macro from lustre_handles.h. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/11498 Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Signed-off-by: James Simmons --- .../staging/lustre/lustre/include/lustre_handles.h |2 -- .../lustre/lustre/obdclass/lustre_handles.c|7 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_handles.h b/drivers/staging/lustre/lustre/include/lustre_handles.h index bc1dd46..e071bac 100644 --- a/drivers/staging/lustre/lustre/include/lustre_handles.h +++ b/drivers/staging/lustre/lustre/include/lustre_handles.h @@ -76,8 +76,6 @@ struct portals_handle { unsigned inth_in:1; }; -#define RCU2HANDLE(rcu)container_of(rcu, struct portals_handle, h_rcu) - /* handles.c */ /* Add a handle to the hash table */ diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c index 8faa318..c9445e5 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c @@ -164,8 +164,11 @@ EXPORT_SYMBOL(class_handle2object); void class_handle_free_cb(struct rcu_head *rcu) { - struct portals_handle *h = RCU2HANDLE(rcu); - void *ptr = (void *)(unsigned long)h->h_cookie; + struct portals_handle *h; + void *ptr; + + h = container_of(rcu, struct portals_handle, h_rcu); + ptr = (void *)(unsigned long)h->h_cookie; if (h->h_ops->hop_free) h->h_ops->hop_free(ptr, h->h_size); -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 028/124] staging: lustre: ldlm: resend AST callbacks
From: Vitaly FertmanWhile clients will resend client->server RPCs, servers would not resend server->client RPCs such as LDLM callbacks (blocking or completion callbacks/ASTs). This could result in clients being evicted from the server if blocking callbacks were dropped by the network (a failed router or lossy network) and the client did not cancel the requested lock in time. In order to fix this problem, this patch adds the ability to resend LDLM callbacks from the server and give the client a chance to respond within the timeout period before it is evicted: - resend BL AST within lock callback timeout period; - still do not resend CANCEL_ON_BLOCK; - regular resend for CP AST without BL AST embedded; - prolong lock callback timeout on resend; some fixes: - recovery-small test_10 to actually evict the client with dropped BL AST; - ETIMEDOUT to be returned if send limit is expired; Signed-off-by: Vitaly Fertman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5520 Reviewed-by: Alexey Lyashkov Reviewed-by: Andriy Skulysh Xyratex-bug-id: MRP-417 Reviewed-on: http://review.whamcloud.com/9335 Reviewed-by: Andreas Dilger Reviewed-by: Johann Lombardi Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_reint.c |9 +++-- drivers/staging/lustre/lustre/ptlrpc/client.c |4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c index c018e3b..af5c92c 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c @@ -113,8 +113,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, if (op_data->op_attr.ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) bits |= MDS_INODELOCK_LOOKUP; if ((op_data->op_flags & MF_MDC_CANCEL_FID1) && - (fid_is_sane(_data->op_fid1)) && - !OBD_FAIL_CHECK(OBD_FAIL_LDLM_BL_CALLBACK_NET)) + (fid_is_sane(_data->op_fid1))) count = mdc_resource_get_unused(exp, _data->op_fid1, , LCK_EX, bits); req = ptlrpc_request_alloc(class_exp2cliimp(exp), @@ -305,14 +304,12 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data, LASSERT(!req); if ((op_data->op_flags & MF_MDC_CANCEL_FID1) && - (fid_is_sane(_data->op_fid1)) && - !OBD_FAIL_CHECK(OBD_FAIL_LDLM_BL_CALLBACK_NET)) + (fid_is_sane(_data->op_fid1))) count = mdc_resource_get_unused(exp, _data->op_fid1, , LCK_EX, MDS_INODELOCK_UPDATE); if ((op_data->op_flags & MF_MDC_CANCEL_FID3) && - (fid_is_sane(_data->op_fid3)) && - !OBD_FAIL_CHECK(OBD_FAIL_LDLM_BL_CALLBACK_NET)) + (fid_is_sane(_data->op_fid3))) count += mdc_resource_get_unused(exp, _data->op_fid3, , LCK_EX, MDS_INODELOCK_FULL); diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index bae91bd..bea1c16 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1037,8 +1037,8 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, *status = -EIO; } else if (ptlrpc_send_limit_expired(req)) { /* probably doesn't need to be a D_ERROR after initial testing */ - DEBUG_REQ(D_ERROR, req, "send limit expired "); - *status = -EIO; + DEBUG_REQ(D_HA, req, "send limit expired "); + *status = -ETIMEDOUT; } else if (req->rq_send_state == LUSTRE_IMP_CONNECTING && imp->imp_state == LUSTRE_IMP_CONNECTING) { /* allow CONNECT even if import is invalid */ -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 037/124] staging: lustre: cleanup lustre_lib.h
From: John L. HammondRemove some unused declarations from lustre_lib.h and move some others to more natural headers. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/11500 Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre_lib.h | 36 drivers/staging/lustre/lustre/include/obd.h| 17 + drivers/staging/lustre/lustre/include/obd_class.h |5 +++ 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h index adb8c47..6b23191 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lib.h +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h @@ -51,7 +51,6 @@ #include "lustre_cfg.h" /* target.c */ -struct kstatfs; struct ptlrpc_request; struct obd_export; struct lu_target; @@ -74,43 +73,8 @@ int do_set_info_async(struct obd_import *imp, u32 vallen, void *val, struct ptlrpc_request_set *set); -#define OBD_RECOVERY_MAX_TIME (obd_timeout * 18) /* b13079 */ - void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id); -/* client.c */ - -int client_sanobd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg); -struct client_obd *client_conn2cli(struct lustre_handle *conn); - -struct md_open_data; -struct obd_client_handle { - struct lustre_handle och_fh; - struct lu_fidoch_fid; - struct md_open_data *och_mod; - struct lustre_handle och_lease_handle; /* open lock for lease */ - __u32och_magic; - fmode_t och_flags; -}; - -#define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed - -/* statfs_pack.c */ -void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs); - -/* Until such time as we get_info the per-stripe maximum from the OST, - * we define this to be 2T - 4k, which is the ext3 maxbytes. - */ -#define LUSTRE_STRIPE_MAXBYTES 0x1fff000ULL - -/* Special values for remove LOV EA from disk */ -#define LOVEA_DELETE_VALUES(size, count, offset) (size == 0 && count == 0 && \ -offset == (typeof(offset))(-1)) - -#define LMVEA_DELETE_VALUES(count, offset) ((count) == 0 && \ - (offset) == (typeof(offset))(-1)) -/* #define POISON_BULK 0 */ - /* * l_wait_event is a flexible sleeping function, permitting simple caller * configuration of interrupt and timeout sensitivity along with actions to diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 89633f7..0917aaa 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -41,6 +41,7 @@ #include "lustre_export.h" #include "lustre_fid.h" #include "lustre_fld.h" +#include "lustre_handles.h" #include "lustre_intent.h" #define MAX_OBD_DEVICES 8192 @@ -72,6 +73,11 @@ static inline void loi_init(struct lov_oinfo *loi) { } +/* Until such time as we get_info the per-stripe maximum from the OST, + * we define this to be 2T - 4k, which is the ext3 maxbytes. + */ +#define LUSTRE_STRIPE_MAXBYTES 0x1fff000ULL + struct lov_stripe_md { atomic_t lsm_refc; spinlock_t lsm_lock; @@ -949,6 +955,17 @@ struct md_open_data { bool mod_is_create; }; +struct obd_client_handle { + struct lustre_handle och_fh; + struct lu_fidoch_fid; + struct md_open_data *och_mod; + struct lustre_handle och_lease_handle; /* open lock for lease */ + __u32och_magic; + int och_flags; +}; + +#define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed + struct lookup_intent; struct cl_attr; diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 8e8df08..6fc54bd 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -1725,6 +1725,11 @@ int class_procfs_clean(void); /* prng.c */ #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t)) +/* statfs_pack.c */ +struct kstatfs; +void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs); +void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs); + /* root squash info */ struct rw_semaphore; struct root_squash_info { -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org
[PATCH 036/124] staging: lustre: llite: no need to check dentry is NULL
From: John L. HammondWe are already touching dentry in CDEBUG macros so it will crash long before these checks. Since this is the case no need to do an additional check. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/10769 Reviewed-by: Yang Sheng Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/namei.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 5e182fc..7a82ae4 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -987,7 +987,7 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild) if (IS_ERR(op_data)) return PTR_ERR(op_data); - if (dchild && dchild->d_inode) + if (dchild->d_inode) op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); op_data->op_fid2 = op_data->op_fid3; @@ -1039,7 +1039,7 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild) if (IS_ERR(op_data)) return PTR_ERR(op_data); - if (dchild && dchild->d_inode) + if (dchild->d_inode) op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); op_data->op_fid2 = op_data->op_fid3; @@ -1120,9 +1120,9 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, if (IS_ERR(op_data)) return PTR_ERR(op_data); - if (src_dchild && src_dchild->d_inode) + if (src_dchild->d_inode) op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode); - if (tgt_dchild && tgt_dchild->d_inode) + if (tgt_dchild->d_inode) op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode); err = md_rename(sbi->ll_md_exp, op_data, -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 012/124] staging: lustre: lmv: fix some byte order issues
From: John L. HammondIn the handler for LL_IOC_LMV_GETSTRIPE convert stripe FIDs from little to CPU endian when unpacking lmv_user_md. In lmv_unpack_md_v1() fix a double conversion of the stripe count. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5342 Reviewed-on: http://review.whamcloud.com/11106 Reviewed-by: Dmitry Eremin Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c |8 drivers/staging/lustre/lustre/lmv/lmv_obd.c |2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index c97a4a0..97815cf 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1252,16 +1252,16 @@ lmv_out_free: tmp->lum_stripe_count = 0; tmp->lum_stripe_offset = mdt_index; for (i = 0; i < stripe_count; i++) { - struct lu_fid *fid; + struct lu_fid fid; - fid = >lmv_md_v1.lmv_stripe_fids[i]; - mdt_index = ll_get_mdt_idx_by_fid(sbi, fid); + fid_le_to_cpu(, >lmv_md_v1.lmv_stripe_fids[i]); + mdt_index = ll_get_mdt_idx_by_fid(sbi, ); if (mdt_index < 0) { rc = mdt_index; goto out_tmp; } tmp->lum_objects[i].lum_mds = mdt_index; - tmp->lum_objects[i].lum_fid = *fid; + tmp->lum_objects[i].lum_fid = fid; tmp->lum_stripe_count++; } diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 11dcbb6..e1fac0b 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2909,7 +2909,7 @@ static int lmv_unpack_md_v1(struct obd_export *exp, struct lmv_stripe_md *lsm, lsm->lsm_md_hash_type, lsm->lsm_md_layout_version); stripe_count = le32_to_cpu(lmm1->lmv_stripe_count); - for (i = 0; i < le32_to_cpu(stripe_count); i++) { + for (i = 0; i < stripe_count; i++) { fid_le_to_cpu(>lsm_md_oinfo[i].lmo_fid, >lmv_stripe_fids[i]); rc = lmv_fld_lookup(lmv, >lsm_md_oinfo[i].lmo_fid, -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 027/124] staging: lustre: ldlm: reconstruct proper flags on enqueue resend
From: Vitaly Fertmanotherwise, waiting lock may get granted as no BLOCKED_GRANTED flag is returned Signed-off-by: Vitaly Fertman Xyratex-bug-id: MRP-1944 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5496 Reviewed-on: http://review.whamcloud.com/11644 Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c |3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c|3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_request.c |6 ++ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 78a8450..861f36f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -470,8 +470,7 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) if (flags & LDLM_FL_FAILED) goto granted; - if (!(flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED | - LDLM_FL_BLOCK_CONV))) { + if (!(flags & LDLM_FL_BLOCKED_MASK)) { if (!data) /* mds granted the lock in the reply */ goto granted; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 55b7460..f516106 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1549,8 +1549,7 @@ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, * before we got a chance to actually enqueue it. We don't * need to do anything else. */ - *flags &= ~(LDLM_FL_BLOCK_GRANTED | - LDLM_FL_BLOCK_CONV | LDLM_FL_BLOCK_WAIT); + *flags &= ~LDLM_FL_BLOCKED_MASK; goto out; } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index f4364f9..cc835cb 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -177,8 +177,7 @@ int ldlm_completion_ast_async(struct ldlm_lock *lock, __u64 flags, void *data) return 0; } - if (!(flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED | - LDLM_FL_BLOCK_CONV))) { + if (!(flags & LDLM_FL_BLOCKED_MASK)) { wake_up(>l_waitq); return ldlm_completion_tail(lock); } @@ -224,8 +223,7 @@ int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) goto noreproc; } - if (!(flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED | - LDLM_FL_BLOCK_CONV))) { + if (!(flags & LDLM_FL_BLOCKED_MASK)) { wake_up(>l_waitq); return 0; } -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 007/124] staging: lustre: obd: add lnb_ prefix to members of struct niobuf_local
From: John L. HammondAdd the prefix lnb_ to the members of struct niobuf_local that do not already have it. Change the struct dentry *lnb_dentry member to void *lnb_data as it is not used to hold a pointer to struct dentry. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5061 Reviewed-on: http://review.whamcloud.com/10451 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h| 10 +- .../staging/lustre/lustre/obdecho/echo_client.c|6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index f3d141b..f55e679 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -437,11 +437,11 @@ struct lmv_obd { struct niobuf_local { __u64 lnb_file_offset; __u32 lnb_page_offset; - __u32 len; - __u32 flags; - struct page *page; - struct dentry *dentry; - int rc; + __u32 lnb_len; + __u32 lnb_flags; + struct page *lnb_page; + void*lnb_data; + int lnb_rc; }; #define LUSTRE_FLD_NAME "fld" diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 7527112..e7c492e 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1452,14 +1452,14 @@ static int echo_client_prep_commit(const struct lu_env *env, LASSERT(lpages == npages); for (i = 0; i < lpages; i++) { - struct page *page = lnb[i].page; + struct page *page = lnb[i].lnb_page; /* read past eof? */ - if (!page && lnb[i].rc == 0) + if (!page && lnb[i].lnb_rc == 0) continue; if (async) - lnb[i].flags |= OBD_BRW_ASYNC; + lnb[i].lnb_flags |= OBD_BRW_ASYNC; if (ostid_id(>o_oi) == ECHO_PERSISTENT_OBJID || (oa->o_valid & OBD_MD_FLFLAGS) == 0 || -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 029/124] staging: lustre: ldlm: restore some of the interval functionality
Earlier a bunch of interval handling got removed since it wasn't used by the upstream client. Now some of it is needed again for the client code so this patch restores what is needed. Signed-off-by: James Simmons--- .../staging/lustre/lustre/include/interval_tree.h | 26 + drivers/staging/lustre/lustre/ldlm/interval_tree.c | 100 +++- 2 files changed, 125 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/interval_tree.h b/drivers/staging/lustre/lustre/include/interval_tree.h index 4a15228..5d387d3 100644 --- a/drivers/staging/lustre/lustre/include/interval_tree.h +++ b/drivers/staging/lustre/lustre/include/interval_tree.h @@ -63,6 +63,11 @@ static inline int interval_is_intree(struct interval_node *node) return node->in_intree == 1; } +static inline __u64 interval_low(struct interval_node *node) +{ + return node->in_extent.start; +} + static inline __u64 interval_high(struct interval_node *node) { return node->in_extent.end; @@ -77,8 +82,29 @@ static inline void interval_set(struct interval_node *node, node->in_max_high = end; } +/* + * Rules to write an interval callback. + * - the callback returns INTERVAL_ITER_STOP when it thinks the iteration + *should be stopped. It will then cause the iteration function to return + *immediately with return value INTERVAL_ITER_STOP. + * - callbacks for interval_iterate and interval_iterate_reverse: Every + *nodes in the tree will be set to @node before the callback being called + * - callback for interval_search: Only overlapped node will be set to @node + *before the callback being called. + */ +typedef enum interval_iter (*interval_callback_t)(struct interval_node *node, + void *args); + struct interval_node *interval_insert(struct interval_node *node, struct interval_node **root); void interval_erase(struct interval_node *node, struct interval_node **root); +/* + * Search the extents in the tree and call @func for each overlapped + * extents. + */ +enum interval_iter interval_search(struct interval_node *root, + struct interval_node_extent *ex, + interval_callback_t func, void *data); + #endif diff --git a/drivers/staging/lustre/lustre/ldlm/interval_tree.c b/drivers/staging/lustre/lustre/ldlm/interval_tree.c index f4a70eb..e134ecd 100644 --- a/drivers/staging/lustre/lustre/ldlm/interval_tree.c +++ b/drivers/staging/lustre/lustre/ldlm/interval_tree.c @@ -90,6 +90,17 @@ static inline int extent_equal(struct interval_node_extent *e1, return (e1->start == e2->start) && (e1->end == e2->end); } +static inline int extent_overlapped(struct interval_node_extent *e1, + struct interval_node_extent *e2) +{ + return (e1->start <= e2->end) && (e2->start <= e1->end); +} + +static inline int node_equal(struct interval_node *n1, struct interval_node *n2) +{ + return extent_equal(>in_extent, >in_extent); +} + static inline __u64 max_u64(__u64 x, __u64 y) { return x > y ? x : y; @@ -262,7 +273,7 @@ struct interval_node *interval_insert(struct interval_node *node, p = root; while (*p) { parent = *p; - if (extent_equal(>in_extent, >in_extent)) + if (node_equal(parent, node)) return parent; /* max_high field must be updated after each iteration */ @@ -463,3 +474,90 @@ color: interval_erase_color(child, parent, root); } EXPORT_SYMBOL(interval_erase); + +static inline int interval_may_overlap(struct interval_node *node, + struct interval_node_extent *ext) +{ + return (ext->start <= node->in_max_high && + ext->end >= interval_low(node)); +} + +/* + * This function finds all intervals that overlap interval ext, + * and calls func to handle resulted intervals one by one. + * in lustre, this function will find all conflicting locks in + * the granted queue and add these locks to the ast work list. + * + * { + * if (!node) + * return 0; + * if (ext->end < interval_low(node)) { + * interval_search(node->in_left, ext, func, data); + * } else if (interval_may_overlap(node, ext)) { + * if (extent_overlapped(ext, >in_extent)) + * func(node, data); + * interval_search(node->in_left, ext, func, data); + * interval_search(node->in_right, ext, func, data); + * } + * return 0; + * } + * + */ +enum interval_iter interval_search(struct interval_node *node, + struct interval_node_extent *ext, + interval_callback_t func, + void *data) +{ + enum interval_iter rc =
[PATCH 002/124] staging: lustre: ptlrpc: enlarge OST_MAXREQSIZE for 4MB RPC
From: Li XiThis patch enlarges OST_MAXREQSIZE so as to make the request size large enough for 4MB RPC. Signed-off-by: Li Xi Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4755 Reviewed-on: http://review.whamcloud.com/9599 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre_net.h |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 24ddcca..6d82998 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -261,7 +261,10 @@ #define MDS_MAXREQSIZE (5 * 1024) /* >= 4736 */ -#define OST_MAXREQSIZE (5 * 1024) +/** + * FIEMAP request can be 4K+ for now + */ +#define OST_MAXREQSIZE (16 * 1024) /* Macro to hide a typecast. */ #define ptlrpc_req_async_args(req) ((void *)>rq_async_args) -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 025/124] staging: lustre: llite: Compare of unsigned value against 0 is always true
From: Dmitry EreminComparison of unsigned value against 0 is always true. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5200 Reviewed-on: http://review.whamcloud.com/11217 Reviewed-by: John L. Hammond Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/lproc_llite.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index af233ea..fc2ba56 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -846,7 +846,7 @@ static ssize_t unstable_stats_store(struct kobject *kobj, if (!count) return 0; - if (count < 0 || count >= sizeof(kernbuf)) + if (count >= sizeof(kernbuf)) return -EINVAL; if (copy_from_user(kernbuf, buffer, count)) -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 019/124] staging: lustre: ptlrpc: fix magic return value of ptlrpc_init_portals
From: Wang ShilongPreviously, when running 'modprobe lustre', it hit the following error message which is becaue of network initialisation failure: modprobe: ERROR: could not insert 'lustre': Input/output error However, error code is there, just let it return to caller, after this patch, error message will be something like: modprobe: ERROR: could not insert 'lustre': Network is down Signed-off-by: Wang Shilong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5455 Reviewed-on: http://review.whamcloud.com/11337 Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/events.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index b1ce725..283dfb2 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -543,7 +543,7 @@ static int ptlrpc_ni_init(void) rc = LNetNIInit(pid); if (rc < 0) { CDEBUG(D_NET, "Can't init network interface: %d\n", rc); - return -ENOENT; + return rc; } /* CAVEAT EMPTOR: how we process portals events is _radically_ @@ -561,7 +561,7 @@ static int ptlrpc_ni_init(void) CERROR("Failed to allocate event queue: %d\n", rc); LNetNIFini(); - return -ENOMEM; + return rc; } int ptlrpc_init_portals(void) @@ -570,7 +570,7 @@ int ptlrpc_init_portals(void) if (rc != 0) { CERROR("network initialisation failed\n"); - return -EIO; + return rc; } rc = ptlrpcd_addref(); if (rc == 0) -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 011/124] staging: lustre: llite: update ras stride offset
From: Bobi JamWhen a read ahead does not reach the end of the region reserved from ras, we'd set ras::ras_next_readahead back to where we left off; For stride read ahead, it needs to make sure that the offset is no less than ras_stride_offset, so that the stride read ahead can work correctly. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5263 Reviewed-on: http://review.whamcloud.com/11181 Reviewed-by: Fan Yong Reviewed-by: wang di Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/rw.c | 18 +++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 25de3bf..de20b7d 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -413,7 +413,7 @@ static int ll_read_ahead_pages(const struct lu_env *env, * forward read-ahead, it will be fixed when backward * read-ahead is implemented */ - LASSERTF(page_idx > ria->ria_stoff, "Invalid page_idx %lu rs %lu re %lu ro %lu rl %lu rp %lu\n", + LASSERTF(page_idx >= ria->ria_stoff, "Invalid page_idx %lu rs %lu re %lu ro %lu rl %lu rp %lu\n", page_idx, ria->ria_start, ria->ria_end, ria->ria_stoff, ria->ria_length, ria->ria_pages); @@ -474,10 +474,22 @@ int ll_readahead(const struct lu_env *env, struct cl_io *io, } /* Reserve a part of the read-ahead window that we'll be issuing */ - if (ras->ras_window_len) { - start = ras->ras_next_readahead; + if (ras->ras_window_len > 0) { + /* +* Note: other thread might rollback the ras_next_readahead, +* if it can not get the full size of prepared pages, see the +* end of this function. For stride read ahead, it needs to +* make sure the offset is no less than ras_stride_offset, +* so that stride read ahead can work correctly. +*/ + if (stride_io_mode(ras)) + start = max(ras->ras_next_readahead, + ras->ras_stride_offset); + else + start = ras->ras_next_readahead; end = ras->ras_window_start + ras->ras_window_len - 1; } + if (end != 0) { unsigned long rpc_boundary; /* -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 021/124] staging: lustre: build: bump build version warnings to x.y.53
From: Andreas DilgerMove the LUSTRE_VERSION_CODE checks to trigger on x.y.53 instead of x.y.50, so that it is into the development cycle that they are hit instead of right at the start. In many cases, the #warning has been removed (to prevent build errors) and instead the code is just disabled outright. The dead code can be seen easily and removed in the future with less interruption to the development process. Signed-off-by: Andreas Dilger Signed-off-by: Emoly Liu Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4217 Reviewed-on: http://review.whamcloud.com/8630 Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin Signed-off-by: James Simmons --- .../staging/lustre/lustre/include/lustre_import.h |2 ++ drivers/staging/lustre/lustre/include/obd.h|2 +- drivers/staging/lustre/lustre/mgc/mgc_request.c|4 +--- drivers/staging/lustre/lustre/obdclass/obd_mount.c |4 +--- drivers/staging/lustre/lustre/ptlrpc/import.c |4 +--- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index b7a7a74..5461ba3 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -285,8 +285,10 @@ struct obd_import { imp_resend_replay:1, /* disable normal recovery, for test only. */ imp_no_pinger_recover:1, +#if OBD_OCD_VERSION(3, 0, 53, 0) > LUSTRE_VERSION_CODE /* need IR MNE swab */ imp_need_mne_swab:1, +#endif /* import must be reconnected instead of * chosing new connection */ diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 37a3acb..838a428 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -317,7 +317,7 @@ struct client_obd { /* used by quotacheck when the servers are older than 2.4 */ int cl_qchk_stat; /* quotacheck stat of the peer */ #define CL_NOT_QUOTACHECKED 1 /* client->cl_qchk_stat init value */ -#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 7, 50, 0) +#if OBD_OCD_VERSION(2, 7, 53, 0) < LUSTRE_VERSION_CODE #warning "please consider removing quotacheck compatibility code" #endif diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 9d0bd47..f3d4f7f 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1428,14 +1428,12 @@ again: } mne_swab = !!ptlrpc_rep_need_swab(req); -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0) +#if OBD_OCD_VERSION(3, 0, 53, 0) > LUSTRE_VERSION_CODE /* This import flag means the server did an extra swab of IR MNE * records (fixed in LU-1252), reverse it here if needed. LU-1644 */ if (unlikely(req->rq_import->imp_need_mne_swab)) mne_swab = !mne_swab; -#else -#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and imp_need_mne_swab" #endif for (i = 0; i < nrpages && ealen > 0; i++) { diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 0273768..0df1aa6 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -384,10 +384,8 @@ int lustre_start_mgc(struct super_block *sb) OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV | OBD_CONNECT_LVB_TYPE; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0) +#if OBD_OCD_VERSION(3, 0, 53, 0) > LUSTRE_VERSION_CODE data->ocd_connect_flags |= OBD_CONNECT_MNE_SWAB; -#else -#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and imp_need_mne_swab" #endif if (lmd_is_client(lsi->lsi_lmd) && diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 93b1e78..013a957 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -1042,7 +1042,7 @@ finish: warned = true; } -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0) +#if OBD_OCD_VERSION(3, 0, 53, 0) > LUSTRE_VERSION_CODE /* Check if server has LU-1252 fix applied to not always swab * the IR MNE entries. Do this only once per connection. This * fixup is version-limited,
[PATCH 006/124] staging: lustre: lmv: Do not ignore ENOENT in lmv_unlink
From: wang diReturn correct value (rc) in lmv_unlink. In lmv_unlink, -ENOENT might be ingored for local directory unlink. Signed-off-by: wang di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5371 Reviewed-on: http://review.whamcloud.com/11170 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lmv/lmv_obd.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 171c260..11dcbb6 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2643,7 +2643,7 @@ try_next_stripe: /* Not cross-ref case, just get out of here. */ if (likely(!(body->mbo_valid & OBD_MD_MDS))) - return 0; + return rc; CDEBUG(D_INODE, "%s: try unlink to another MDT for "DFID"\n", exp->exp_obd->obd_name, PFID(>mbo_fid1)); -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 053/124] staging: lustre: obd: restore linkea support
Original linkea was only used for the lustre server code so it was removed from the upstream client. Now it needs to be restored for client work that uses this infrastructure. Signed-off-by: James Simmons--- drivers/staging/lustre/lustre/include/lu_object.h |7 + .../staging/lustre/lustre/include/lustre_linkea.h | 79 drivers/staging/lustre/lustre/obdclass/Makefile|2 +- drivers/staging/lustre/lustre/obdclass/linkea.c| 201 drivers/staging/lustre/lustre/obdclass/lu_object.c | 70 +++ 5 files changed, 358 insertions(+), 1 deletions(-) create mode 100644 drivers/staging/lustre/lustre/include/lustre_linkea.h create mode 100644 drivers/staging/lustre/lustre/obdclass/linkea.c diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 66ab98a..7b37cae 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -1319,5 +1319,12 @@ struct lu_kmem_descr { int lu_kmem_init(struct lu_kmem_descr *caches); void lu_kmem_fini(struct lu_kmem_descr *caches); +void lu_buf_free(struct lu_buf *buf); +void lu_buf_alloc(struct lu_buf *buf, size_t size); +void lu_buf_realloc(struct lu_buf *buf, size_t size); + +int lu_buf_check_and_grow(struct lu_buf *buf, size_t len); +struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, size_t len); + /** @} lu */ #endif /* __LUSTRE_LU_OBJECT_H */ diff --git a/drivers/staging/lustre/lustre/include/lustre_linkea.h b/drivers/staging/lustre/lustre/include/lustre_linkea.h new file mode 100644 index 000..249e8bf --- /dev/null +++ b/drivers/staging/lustre/lustre/include/lustre_linkea.h @@ -0,0 +1,79 @@ +/* + * 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) 2013, 2014, Intel Corporation. + * Use is subject to license terms. + * + * Author: di wang + */ + +#define DEFAULT_LINKEA_SIZE4096 + +struct linkea_data { + /** +* Buffer to keep link EA body. +*/ + struct lu_buf *ld_buf; + /** +* The matched header, entry and its length in the EA +*/ + struct link_ea_header *ld_leh; + struct link_ea_entry*ld_lee; + int ld_reclen; +}; + +int linkea_data_new(struct linkea_data *ldata, struct lu_buf *buf); +int linkea_init(struct linkea_data *ldata); +void linkea_entry_unpack(const struct link_ea_entry *lee, int *reclen, +struct lu_name *lname, struct lu_fid *pfid); +int linkea_entry_pack(struct link_ea_entry *lee, const struct lu_name *lname, + const struct lu_fid *pfid); +int linkea_add_buf(struct linkea_data *ldata, const struct lu_name *lname, + const struct lu_fid *pfid); +void linkea_del_buf(struct linkea_data *ldata, const struct lu_name *lname); +int linkea_links_find(struct linkea_data *ldata, const struct lu_name *lname, + const struct lu_fid *pfid); + +static inline void linkea_first_entry(struct linkea_data *ldata) +{ + LASSERT(ldata); + LASSERT(ldata->ld_leh); + + if (ldata->ld_leh->leh_reccount == 0) + ldata->ld_lee = NULL; + else + ldata->ld_lee = (struct link_ea_entry *)(ldata->ld_leh + 1); +} + +static inline void linkea_next_entry(struct linkea_data *ldata) +{ + LASSERT(ldata); + LASSERT(ldata->ld_leh); + + if (ldata->ld_lee) { + ldata->ld_lee = (struct link_ea_entry *)((char *)ldata->ld_lee + +ldata->ld_reclen); + if ((char *)ldata->ld_lee >= ((char *)ldata->ld_leh + + ldata->ld_leh->leh_len)) + ldata->ld_lee = NULL; + } +} diff --git a/drivers/staging/lustre/lustre/obdclass/Makefile b/drivers/staging/lustre/lustre/obdclass/Makefile index df7e47f..b42e109 100644 --- a/drivers/staging/lustre/lustre/obdclass/Makefile +++ b/drivers/staging/lustre/lustre/obdclass/Makefile @@ -3,6 +3,6 @@ obj-$(CONFIG_LUSTRE_FS) += obdclass.o obdclass-y := linux/linux-module.o
[PATCH 004/124] staging: lustre: lmv: honor MDT index when creating volatile file
From: wang diLMV should honor MDT index embedded in the name of volatile file, then during hsm restore, the file under striped dir can be restored to the right MDT. Signed-off-by: wang di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4691 Reviewed-on: http://review.whamcloud.com/10866 Reviewed-by: Andreas Dilger Reviewed-by: Henri Doreau Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre/lustre_user.h |1 + drivers/staging/lustre/lustre/llite/dir.c | 17 ++ drivers/staging/lustre/lustre/llite/llite_lib.c|5 +- drivers/staging/lustre/lustre/lmv/lmv_fld.c| 16 +++--- drivers/staging/lustre/lustre/lmv/lmv_internal.h |5 ++ drivers/staging/lustre/lustre/lmv/lmv_obd.c| 52 ++- 6 files changed, 84 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index 351fb4c..c69918b 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -244,6 +244,7 @@ struct ost_id { #define LL_IOC_HSM_IMPORT _IOWR('f', 245, struct hsm_user_import) #define LL_IOC_LMV_SET_DEFAULT_STRIPE _IOWR('f', 246, struct lmv_user_md) #define LL_IOC_MIGRATE _IOR('f', 247, int) +#define LL_IOC_FID2MDTIDX _IOWR('f', 248, struct lu_fid) #define LL_STATFS_LMV 1 #define LL_STATFS_LOV 2 diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 532047b..c97a4a0 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1568,6 +1568,23 @@ out_quotactl: return rc; case OBD_IOC_FID2PATH: return ll_fid2path(inode, (void __user *)arg); + case LL_IOC_FID2MDTIDX: { + struct obd_export *exp = ll_i2mdexp(inode); + struct lu_fid fid; + __u32 index; + + if (copy_from_user(, (const struct lu_fid __user *)arg, + sizeof(fid))) + return -EFAULT; + + /* Call mdc_iocontrol */ + rc = obd_iocontrol(LL_IOC_FID2MDTIDX, exp, sizeof(fid), , + ); + if (rc) + return rc; + + return index; + } case LL_IOC_HSM_REQUEST: { struct hsm_user_request *hur; ssize_t totalsize; diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 1ff788e..99aba6b 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -2373,9 +2373,10 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, op_data->op_bias = 0; op_data->op_cli_flags = 0; if ((opc == LUSTRE_OPC_CREATE) && name && - filename_is_volatile(name, namelen, NULL)) + filename_is_volatile(name, namelen, _data->op_mds)) op_data->op_bias |= MDS_CREATE_VOLATILE; - op_data->op_mds = 0; + else + op_data->op_mds = 0; op_data->op_data = data; /* When called by ll_setattr_raw, file is i1. */ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_fld.c b/drivers/staging/lustre/lustre/lmv/lmv_fld.c index a3d170a..715179f 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_fld.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_fld.c @@ -47,18 +47,20 @@ #include "../include/lprocfs_status.h" #include "lmv_internal.h" -int lmv_fld_lookup(struct lmv_obd *lmv, - const struct lu_fid *fid, - u32 *mds) +int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds) { + struct obd_device *obd = lmv2obd_dev(lmv); int rc; - /* FIXME: Currently ZFS still use local seq for ROOT unfortunately, and + /* +* FIXME: Currently ZFS still use local seq for ROOT unfortunately, and * this fid_is_local check should be removed once LU-2240 is fixed */ - LASSERTF((fid_seq_in_fldb(fid_seq(fid)) || - fid_seq_is_local_file(fid_seq(fid))) && -fid_is_sane(fid), DFID" is insane!\n", PFID(fid)); + if (!fid_is_sane(fid) || !(fid_seq_in_fldb(fid_seq(fid)) || + fid_seq_is_local_file(fid_seq(fid { + CERROR("%s: invalid FID " DFID "\n", obd->obd_name, PFID(fid)); + return -EINVAL; + } rc = fld_client_lookup(>lmv_fld, fid_seq(fid), mds, LU_SEQ_RANGE_MDT, NULL); diff --git
[PATCH 013/124] staging: lustre: osc: update kms in brw_interpret() properly
From: Niu YaweiIn brw_interpret(), we forgot page offset when calculating write offset, that leads to wrong kms for sync write. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5463 Reviewed-on: http://review.whamcloud.com/11374 Reviewed-by: Bobi Jam Reviewed-by: Jinshan Xiong Reviewed-by: Li Dongyang Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_request.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index e861973..e44b4fa 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1796,7 +1796,8 @@ static int brw_interpret(const struct lu_env *env, if (lustre_msg_get_opc(req->rq_reqmsg) == OST_WRITE) { struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; - loff_t last_off = last->oap_count + last->oap_obj_off; + loff_t last_off = last->oap_count + last->oap_obj_off + + last->oap_page_off; /* Change file size if this is an out of quota or * direct IO write and it extends the file size -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 009/124] staging: lustre: obdclass: serialize lu_site purge
From: Niu YaweiUmount process relies on lu_site_purge(-1) to purge all objects before umount, however, if there happen to have a cache shrinker which calls lu_site_purge(nr) in parallel, some objects may still being freed by cache shrinker even after the lu_site_purge(-1) called by umount done. This can be simply fixed by serializing purge threads, since it doesn't make any sense to have them in parallel. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5331 Reviewed-on: http://review.whamcloud.com/11099 Reviewed-by: Lai Siyao Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lu_object.h |5 + drivers/staging/lustre/lustre/obdclass/lu_object.c |7 +++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 502bc41..fe40b42 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -623,6 +623,11 @@ struct lu_site { spinlock_t ls_ld_lock; /** +* Lock to serialize site purge. +*/ + struct mutexls_purge_mutex; + + /** * lu_site stats */ struct lprocfs_stats*ls_stats; diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 9d1c96b..b6fd9af 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -354,6 +354,11 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) start = s->ls_purge_start; bnr = (nr == ~0) ? -1 : nr / CFS_HASH_NBKT(s->ls_obj_hash) + 1; again: + /* +* It doesn't make any sense to make purge threads parallel, that can +* only bring troubles to us. See LU-5331. +*/ + mutex_lock(>ls_purge_mutex); did_sth = 0; cfs_hash_for_each_bucket(s->ls_obj_hash, , i) { if (i < start) @@ -399,6 +404,7 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) if (nr == 0) break; } + mutex_unlock(>ls_purge_mutex); if (nr != 0 && did_sth && start != 0) { start = 0; /* restart from the first bucket */ @@ -983,6 +989,7 @@ int lu_site_init(struct lu_site *s, struct lu_device *top) char name[16]; memset(s, 0, sizeof(*s)); + mutex_init(>ls_purge_mutex); snprintf(name, 16, "lu_site_%s", top->ld_type->ldt_name); for (bits = lu_htable_order(top); bits >= LU_SITE_BITS_MIN; bits--) { s->ls_obj_hash = cfs_hash_create(name, bits, bits, -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 015/124] staging: lustre: clio: lu_ref_del() mismatch ref add scope
From: Bobi Jam'commit 77605e41a26f ("staging/lustre/clio: add pages into writeback cache in batches")' adds a page to a list aggregate issuing them to writeback cache; A page add is referenced in llite/vvp io scope, while writeback cache commit de-refers it under osc sub io scope, and enabling -lu_ref will detect this scope mismatch. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4503 Reviewed-on: http://review.whamcloud.com/8970 Reviewed-by: frank zago Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/vvp_io.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 94916dc..09ccd1f 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -821,7 +821,7 @@ static void write_commit_callback(const struct lu_env *env, struct cl_io *io, cl_page_disown(env, io, page); /* held in ll_cl_init() */ - lu_ref_del(>cp_reference, "cl_io", io); + lu_ref_del(>cp_reference, "cl_io", cl_io_top(io)); cl_page_put(env, page); } -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 003/124] staging: lustre: ldlm: fix a use after free in ldlm_resource_get()
From: John L. HammondIf lvbo initialization has failed then save the return status (from lr_lvb_len) before putting the resource. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5305 Reviewed-on: http://review.whamcloud.com/11017 Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 62d9f6f..912cd68 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -1091,6 +1091,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, struct cfs_hash_bd bd; __u64version; int ns_refcount = 0; + int rc; LASSERT(!parent); LASSERT(ns->ns_rs_hash); @@ -1140,8 +1141,9 @@ lvbo_init: } if (unlikely(res->lr_lvb_len < 0)) { + rc = res->lr_lvb_len; ldlm_resource_putref(res); - res = ERR_PTR(res->lr_lvb_len); + res = ERR_PTR(rc); } return res; } @@ -1152,8 +1154,6 @@ lvbo_init: cfs_hash_bd_unlock(ns->ns_rs_hash, , 1); if (ns->ns_lvbo && ns->ns_lvbo->lvbo_init) { - int rc; - OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CREATE_RESOURCE, 2); rc = ns->ns_lvbo->lvbo_init(res); if (rc < 0) { -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: lustre: lmv: mark symbols static where possible
On Sep 17, 2016, at 06:04, Baoyou Xiewrote: > > We get a few warnings when building kernel with W=1: > drivers/staging/lustre/lustre/lmv/lmv_obd.c:1640:1: warning: no previous > prototype for 'lmv_locate_target_for_name' [-Wmissing-prototypes] > drivers/staging/lustre/lustre/lmv/lmv_obd.c:2421:5: warning: no previous > prototype for 'lmv_read_page' [-Wmissing-prototypes] > > > In fact, these functions are only used in the file in which they are > declared and don't need a declaration, but can be made static. > so this patch marks these functions with 'static'. > > Signed-off-by: Baoyou Xie Reviewed by: Andreas Dilger > --- > drivers/staging/lustre/lustre/lmv/lmv_obd.c | 38 - > 1 file changed, 21 insertions(+), 17 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c > b/drivers/staging/lustre/lustre/lmv/lmv_obd.c > index dc752d5..5783359 100644 > --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c > +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c > @@ -1636,7 +1636,7 @@ static int lmv_close(struct obd_export *exp, struct > md_op_data *op_data, > * For striped-directory, it will locate MDT by name. And also > * it will reset op_fid1 with the FID of the chosen stripe. > **/ > -struct lmv_tgt_desc * > +static struct lmv_tgt_desc * > lmv_locate_target_for_name(struct lmv_obd *lmv, struct lmv_stripe_md *lsm, > const char *name, int namelen, struct lu_fid *fid, > u32 *mds) > @@ -2418,9 +2418,9 @@ static int lmv_read_striped_page(struct obd_export *exp, > return rc; > } > > -int lmv_read_page(struct obd_export *exp, struct md_op_data *op_data, > - struct md_callback *cb_op, __u64 offset, > - struct page **ppage) > +static int lmv_read_page(struct obd_export *exp, struct md_op_data *op_data, > + struct md_callback *cb_op, __u64 offset, > + struct page **ppage) > { > struct lmv_stripe_md *lsm = op_data->op_mea1; > struct obd_device *obd = exp->exp_obd; > @@ -2771,8 +2771,9 @@ static int lmv_pack_md_v1(const struct lmv_stripe_md > *lsm, > return 0; > } > > -int lmv_pack_md(union lmv_mds_md **lmmp, const struct lmv_stripe_md *lsm, > - int stripe_count) > +static int > +lmv_pack_md(union lmv_mds_md **lmmp, const struct lmv_stripe_md *lsm, > + int stripe_count) > { > int lmm_size = 0, rc = 0; > bool allocated = false; > @@ -2966,15 +2967,15 @@ int lmv_unpack_md(struct obd_export *exp, struct > lmv_stripe_md **lsmp, > } > EXPORT_SYMBOL(lmv_unpack_md); > > -int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, > - struct lov_mds_md *lmm, int disk_len) > +static int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, > + struct lov_mds_md *lmm, int disk_len) > { > return lmv_unpack_md(exp, (struct lmv_stripe_md **)lsmp, >(union lmv_mds_md *)lmm, disk_len); > } > > -int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, > -struct lov_stripe_md *lsm) > +static int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, > + struct lov_stripe_md *lsm) > { > const struct lmv_stripe_md *lmv = (struct lmv_stripe_md *)lsm; > struct obd_device *obd = exp->exp_obd; > @@ -3177,9 +3178,10 @@ static int lmv_revalidate_lock(struct obd_export *exp, > struct lookup_intent *it, > return rc; > } > > -int lmv_get_fid_from_lsm(struct obd_export *exp, > - const struct lmv_stripe_md *lsm, > - const char *name, int namelen, struct lu_fid *fid) > +static int > +lmv_get_fid_from_lsm(struct obd_export *exp, > + const struct lmv_stripe_md *lsm, > + const char *name, int namelen, struct lu_fid *fid) > { > const struct lmv_oinfo *oinfo; > > @@ -3269,14 +3271,16 @@ static int lmv_quotacheck(struct obd_device *unused, > struct obd_export *exp, > return rc; > } > > -int lmv_update_lsm_md(struct obd_export *exp, struct lmv_stripe_md *lsm, > - struct mdt_body *body, ldlm_blocking_callback cb_blocking) > +static int > +lmv_update_lsm_md(struct obd_export *exp, struct lmv_stripe_md *lsm, > + struct mdt_body *body, ldlm_blocking_callback cb_blocking) > { > return lmv_revalidate_slaves(exp, body, lsm, cb_blocking, 0); > } > > -int lmv_merge_attr(struct obd_export *exp, const struct lmv_stripe_md *lsm, > -struct cl_attr *attr) > +static int > +lmv_merge_attr(struct obd_export *exp, const struct lmv_stripe_md *lsm, > +struct cl_attr *attr) > { > int i; > > -- > 2.7.4 > ___ devel mailing list de...@linuxdriverproject.org
Re: [PATCH] staging: lustre: lustre/ldlm: Fixed sparse warnings
On Sep 18, 2016, at 14:21, nayeemwrote: > On Friday 16 September 2016 01:30 PM, Dilger, Andreas wrote: >> On Sep 15, 2016, at 12:33, nayeem wrote: >>> On Wednesday 14 September 2016 10:44 AM, Dilger, Andreas wrote: On Sep 12, 2016, at 04:27, Greg KH wrote: > > On Fri, Sep 09, 2016 at 08:50:35PM +0530, Nayeemahmed Badebade wrote: >> Added __acquires / __releases sparse locking annotations >> to lock_res_and_lock and unlock_res_and_lock functions in >> l_lock.c, to fix below sparse warnings: >> >> l_lock.c:47:22: warning: context imbalance in 'lock_res_and_lock' - >> wrong count at exit >> l_lock.c:62:6: warning: context imbalance in 'unlock_res_and_lock' - >> unexpected unlock >> >> Signed-off-by: Nayeemahmed Badebade >> --- >> drivers/staging/lustre/lustre/ldlm/l_lock.c | 4 >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/staging/lustre/lustre/ldlm/l_lock.c >> b/drivers/staging/lustre/lustre/ldlm/l_lock.c >> index ea8840c..c4b9612 100644 >> --- a/drivers/staging/lustre/lustre/ldlm/l_lock.c >> +++ b/drivers/staging/lustre/lustre/ldlm/l_lock.c >> @@ -45,6 +45,8 @@ >> * being an atomic operation. >> */ >> struct ldlm_resource *lock_res_and_lock(struct ldlm_lock *lock) >> +__acquires(>l_lock) >> +__acquires(lock->l_resource) > > Hm, these are tricky, I don't want to take this type of change without > an ack from the lustre developers... The "__acquires(>l_lock)" line here looks correct, along with the corresponding "__releases(>l_lock)" at unlock_res_and_lock(). The problem, however, is that "l_resource" is not a lock, but rather a struct. The call to "lock_res(lock->l_resource)" is actually locking "lr_lock" internally. It would be better to add "__acquires(>lr_lock)" at lock_res() and "__releases(>lr_lock)" at unlock_res(). That will also forestall any other warnings about an imbalance with lock_res()/unlock_res() or their callsites. Cheers, Andreas >>> >>> Hi Andreas, >>> >>> Thank you for your review comments. I did the change according to your >>> comments and the diff is attached to mail. But this change doesn't seem to >>> fix the sparse warning. >>> With this change when i compile the code "make C=2 >>> ./drivers/staging/lustre/lustre/", sparse warning still comes: >> >>> {{{ >>> CHECK drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c >>> drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c:47:22: >>> warning: context imbalance in 'lock_res_and_lock' - wrong count at exit >>> drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c:62:6: >>> warning: context imbalance in 'unlock_res_and_lock' - unexpected unlock >>> CC [M] drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.o >>> }}} >> >> Strange, one would think that your patch should work properly. Maybe the >> __acquires() label doesn't work on inline functions? >> > > I think sparse works on inline functions. > I ran sparse on a hello world kernel module in different cases explained below > > >>> Would it be a good idea to add "__acquires(>l_resource->lr_lock)" & >>> "__acquires(>l_lock)" at lock_res_and_lock() and >>> "__releases(>l_resource->lr_lock)" & "__releases(>l_lock)" at >>> unlock_res_and_lock() ? >>> Because with that change the sparse warning is fixed. >>> {{{ >>> CHECK drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c >>> CC [M] drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.o >>> }}} >> >> This would also be possible, but then it exposes any callers of lock_res() >> and unlock() res to similar compiler warnings in the future. I'm not >> against this in principle, but it is worthwhile to see why sparse is not >> handling this case correctly. >> >> Cheers, Andreas >> > > case 1: > --- > hello.c, where spin_lock() and spin_unlock() are called indirectly via > foo_lock() and foo_unlock() in the same function i.e "say_hello()" in below > code. > > The following code when checked with sparse doesn't give any warning > > #include > #include > > static DEFINE_SPINLOCK(my_lock); > > static inline void foo_lock(spinlock_t *spl) > { >spin_lock(spl); > } > > static inline void foo_unlock(spinlock_t *spl) > { >spin_unlock(spl); > } > > static int __init say_hello(void) > { >foo_lock(_lock); >pr_info("Hello World!\n"); >foo_unlock(_lock); >return 0; > } > > static void __exit cleanup(void) > { > } > > module_init(say_hello); > module_exit(cleanup); > > > > case 2. > -- > The above code when slightly modified so that, spin_lock() is called > indirectly via foo_lock() in say_hello()
Re: [PATCH] staging: lustre: lustre/ldlm: Fixed sparse warnings
On Friday 16 September 2016 01:30 PM, Dilger, Andreas wrote: On Sep 15, 2016, at 12:33, nayeemwrote: On Wednesday 14 September 2016 10:44 AM, Dilger, Andreas wrote: On Sep 12, 2016, at 04:27, Greg KH wrote: On Fri, Sep 09, 2016 at 08:50:35PM +0530, Nayeemahmed Badebade wrote: Added __acquires / __releases sparse locking annotations to lock_res_and_lock and unlock_res_and_lock functions in l_lock.c, to fix below sparse warnings: l_lock.c:47:22: warning: context imbalance in 'lock_res_and_lock' - wrong count at exit l_lock.c:62:6: warning: context imbalance in 'unlock_res_and_lock' - unexpected unlock Signed-off-by: Nayeemahmed Badebade --- drivers/staging/lustre/lustre/ldlm/l_lock.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/ldlm/l_lock.c b/drivers/staging/lustre/lustre/ldlm/l_lock.c index ea8840c..c4b9612 100644 --- a/drivers/staging/lustre/lustre/ldlm/l_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/l_lock.c @@ -45,6 +45,8 @@ * being an atomic operation. */ struct ldlm_resource *lock_res_and_lock(struct ldlm_lock *lock) + __acquires(>l_lock) + __acquires(lock->l_resource) Hm, these are tricky, I don't want to take this type of change without an ack from the lustre developers... The "__acquires(>l_lock)" line here looks correct, along with the corresponding "__releases(>l_lock)" at unlock_res_and_lock(). The problem, however, is that "l_resource" is not a lock, but rather a struct. The call to "lock_res(lock->l_resource)" is actually locking "lr_lock" internally. It would be better to add "__acquires(>lr_lock)" at lock_res() and "__releases(>lr_lock)" at unlock_res(). That will also forestall any other warnings about an imbalance with lock_res()/unlock_res() or their callsites. Cheers, Andreas Hi Andreas, Thank you for your review comments. I did the change according to your comments and the diff is attached to mail. But this change doesn't seem to fix the sparse warning. With this change when i compile the code "make C=2 ./drivers/staging/lustre/lustre/", sparse warning still comes: {{{ CHECK drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c:47:22: warning: context imbalance in 'lock_res_and_lock' - wrong count at exit drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c:62:6: warning: context imbalance in 'unlock_res_and_lock' - unexpected unlock CC [M] drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.o }}} Strange, one would think that your patch should work properly. Maybe the __acquires() label doesn't work on inline functions? I think sparse works on inline functions. I ran sparse on a hello world kernel module in different cases explained below Would it be a good idea to add "__acquires(>l_resource->lr_lock)" & "__acquires(>l_lock)" at lock_res_and_lock() and "__releases(>l_resource->lr_lock)" & "__releases(>l_lock)" at unlock_res_and_lock() ? Because with that change the sparse warning is fixed. {{{ CHECK drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.c CC [M] drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/l_lock.o }}} This would also be possible, but then it exposes any callers of lock_res() and unlock() res to similar compiler warnings in the future. I'm not against this in principle, but it is worthwhile to see why sparse is not handling this case correctly. Cheers, Andreas case 1: --- hello.c, where spin_lock() and spin_unlock() are called indirectly via foo_lock() and foo_unlock() in the same function i.e "say_hello()" in below code. The following code when checked with sparse doesn't give any warning #include #include static DEFINE_SPINLOCK(my_lock); static inline void foo_lock(spinlock_t *spl) { spin_lock(spl); } static inline void foo_unlock(spinlock_t *spl) { spin_unlock(spl); } static int __init say_hello(void) { foo_lock(_lock); pr_info("Hello World!\n"); foo_unlock(_lock); return 0; } static void __exit cleanup(void) { } module_init(say_hello); module_exit(cleanup); case 2. -- The above code when slightly modified so that, spin_lock() is called indirectly via foo_lock() in say_hello() and spin_unlock() via foo_unlock() in cleanup() static int __init say_hello(void) { foo_lock(_lock); pr_info("Hello World!\n"); return 0; } static void __exit cleanup(void) { foo_unlock(_lock); } Then sparse gives the warning: {{{ test-module/hello.c:16:19: warning: context imbalance in 'say_hello' - wrong count at exit test-module/hello.c:23:20: warning: context imbalance in 'cleanup' - unexpected unlock }}} To fix this if we put sparse annotations __acquires() at foo_lock() and __releases() at foo_unlock(), then also
Re: [PATCH] staging: lustre: lmv: add missing function declaration
> We get 1 warning when building kernel with W=1: > drivers/staging/lustre/lustre/lmv/lmv_obd.c:2774:5: warning: no previous > prototype for 'lmv_pack_md' [-Wmissing-prototypes] > > In fact, this function is not declared in any file,but should be > declared in a header file, thus can be recognized in other file. > > So this patch adds the declarations into > drivers/staging/lustre/lustre/include/lustre_lmv.h. > > Signed-off-by: Baoyou Xie> --- > drivers/staging/lustre/lustre/include/lustre_lmv.h | 2 ++ > 1 file changed, 2 insertions(+) Nak. I'm not seeing this error with W=1. Also if you look lmv_pack_md() is only used in lmv_obd.c and the function appears early in the file before it is used, so no prototype missing errors should happen. > diff --git a/drivers/staging/lustre/lustre/include/lustre_lmv.h > b/drivers/staging/lustre/lustre/include/lustre_lmv.h > index 085e596..21302c7 100644 > --- a/drivers/staging/lustre/lustre/include/lustre_lmv.h > +++ b/drivers/staging/lustre/lustre/include/lustre_lmv.h > @@ -119,3 +119,5 @@ static inline void lmv_le_to_cpu(union lmv_mds_md > *lmv_dst, > } > > +int lmv_pack_md(union lmv_mds_md **lmmp, const struct lmv_stripe_md *lsm, > + int stripe_count); > #endif > -- > 2.7.4 > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rts5208: rtsx_card.c: Fixed brace style issues
Fixed several minor brace coding style issues. Signed-off-by: Cathal Mullaney--- drivers/staging/rts5208/rtsx_card.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_card.c b/drivers/staging/rts5208/rtsx_card.c index 91e62c1..9771774 100644 --- a/drivers/staging/rts5208/rtsx_card.c +++ b/drivers/staging/rts5208/rtsx_card.c @@ -1027,26 +1027,26 @@ int card_share_mode(struct rtsx_chip *chip, int card) if (CHECK_PID(chip, 0x5208)) { mask = CARD_SHARE_MASK; - if (card == SD_CARD) + if (card == SD_CARD) { value = CARD_SHARE_48_SD; - else if (card == MS_CARD) + } else if (card == MS_CARD) { value = CARD_SHARE_48_MS; - else if (card == XD_CARD) + } else if (card == XD_CARD) { value = CARD_SHARE_48_XD; - else { + } else { rtsx_trace(chip); return STATUS_FAIL; } } else if (CHECK_PID(chip, 0x5288)) { mask = 0x03; - if (card == SD_CARD) + if (card == SD_CARD) { value = CARD_SHARE_BAROSSA_SD; - else if (card == MS_CARD) + } else if (card == MS_CARD) { value = CARD_SHARE_BAROSSA_MS; - else if (card == XD_CARD) + } else if (card == XD_CARD) { value = CARD_SHARE_BAROSSA_XD; - else { + } else { rtsx_trace(chip); return STATUS_FAIL; } @@ -1072,15 +1072,15 @@ int select_card(struct rtsx_chip *chip, int card) if (chip->cur_card != card) { u8 mod; - if (card == SD_CARD) + if (card == SD_CARD) { mod = SD_MOD_SEL; - else if (card == MS_CARD) + } else if (card == MS_CARD) { mod = MS_MOD_SEL; - else if (card == XD_CARD) + } else if (card == XD_CARD) { mod = XD_MOD_SEL; - else if (card == SPI_CARD) + } else if (card == SPI_CARD) { mod = SPI_MOD_SEL; - else { + } else { rtsx_trace(chip); return STATUS_FAIL; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/11] staging: r8188eu: replace N_BYTE_ALIGMENT macro with PTR_ALIGN
PTR_ALIGN is a bit shorter than N_BYTE_ALIGMENT. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/core/rtw_recv.c | 2 +- drivers/staging/rtl8188eu/core/rtw_xmit.c | 6 +++--- drivers/staging/rtl8188eu/include/basic_types.h | 4 drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 1063617..b87cbbb 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -73,7 +73,7 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) if (!precvpriv->pallocated_frame_buf) return _FAIL; - precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ); + precvpriv->precv_frame_buf = PTR_ALIGN(precvpriv->pallocated_frame_buf, RXFRAME_ALIGN_SZ); precvframe = (struct recv_frame *)precvpriv->precv_frame_buf; diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index e028ff4..56c6604 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -86,7 +86,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) res = _FAIL; goto exit; } - pxmitpriv->pxmit_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_frame_buf), 4); + pxmitpriv->pxmit_frame_buf = PTR_ALIGN(pxmitpriv->pallocated_frame_buf, 4); /* pxmitpriv->pxmit_frame_buf = pxmitpriv->pallocated_frame_buf + 4 - */ /* ((size_t) (pxmitpriv->pallocated_frame_buf) &3); */ @@ -124,7 +124,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) goto exit; } - pxmitpriv->pxmitbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmitbuf), 4); + pxmitpriv->pxmitbuf = PTR_ALIGN(pxmitpriv->pallocated_xmitbuf, 4); /* pxmitpriv->pxmitbuf = pxmitpriv->pallocated_xmitbuf + 4 - */ /* ((size_t) (pxmitpriv->pallocated_xmitbuf) &3); */ @@ -166,7 +166,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) goto exit; } - pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmit_extbuf), 4); + pxmitpriv->pxmit_extbuf = PTR_ALIGN(pxmitpriv->pallocated_xmit_extbuf, 4); pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf; diff --git a/drivers/staging/rtl8188eu/include/basic_types.h b/drivers/staging/rtl8188eu/include/basic_types.h index 2c1676d..69c4d49 100644 --- a/drivers/staging/rtl8188eu/include/basic_types.h +++ b/drivers/staging/rtl8188eu/include/basic_types.h @@ -137,8 +137,4 @@ value to host byte ordering.*/ u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \ ) -/* Get the N-bytes aligment offset from the current length */ -#defineN_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \ - (__value) : (((__value + __aligment - 1) / __aligment) * __aligment)) - #endif /* __BASIC_TYPES_H__ */ diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c index 221e275..4b1b04e 100644 --- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c @@ -72,7 +72,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb if (pxmitbuf->pallocated_buf == NULL) return _FAIL; - pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ); + pxmitbuf->pbuf = PTR_ALIGN(pxmitbuf->pallocated_buf, XMITBUF_ALIGN_SZ); pxmitbuf->dma_transfer_addr = 0; for (i = 0; i < 8; i++) { -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/11] staging: r8188eu: set correct type for HalData member of adapter structure
To avoid unnecessary typecast. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/include/drv_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/drv_types.h b/drivers/staging/rtl8188eu/include/drv_types.h index 7af690e..5c275fb 100644 --- a/drivers/staging/rtl8188eu/include/drv_types.h +++ b/drivers/staging/rtl8188eu/include/drv_types.h @@ -154,7 +154,7 @@ struct adapter { struct eeprom_priv eeprompriv; struct led_privledpriv; - void *HalData; + struct hal_data_8188e *HalData; s32 bDriverStopped; s32 bSurpriseRemoved; -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/11] staging: r8188eu: remove GET_HAL_DATA macro
GET_HAL_DATA replaced by its definition. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/core/rtw_sreset.c | 9 +-- drivers/staging/rtl8188eu/hal/bb_cfg.c| 13 ++-- drivers/staging/rtl8188eu/hal/odm.c | 17 ++--- drivers/staging/rtl8188eu/hal/phy.c | 40 -- drivers/staging/rtl8188eu/hal/rf.c| 16 ++-- drivers/staging/rtl8188eu/hal/rf_cfg.c| 6 +- drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c | 18 ++--- drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 28 +++ drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 26 +++ drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 4 +- drivers/staging/rtl8188eu/hal/rtl8188eu_led.c | 6 +- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c| 22 ++ drivers/staging/rtl8188eu/hal/usb_halinit.c | 91 +-- drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 3 - drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 12 +-- 15 files changed, 124 insertions(+), 187 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_sreset.c b/drivers/staging/rtl8188eu/core/rtw_sreset.c index 5d631c5..a198c57 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sreset.c +++ b/drivers/staging/rtl8188eu/core/rtw_sreset.c @@ -18,16 +18,14 @@ void rtw_hal_sreset_init(struct adapter *padapter) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = >srestpriv; + struct sreset_priv *psrtpriv = >HalData->srestpriv; psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; } u8 sreset_get_wifi_status(struct adapter *padapter) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); - struct sreset_priv *psrtpriv = >srestpriv; + struct sreset_priv *psrtpriv = >HalData->srestpriv; u8 status = WIFI_STATUS_SUCCESS; u32 val32 = 0; @@ -54,6 +52,5 @@ u8 sreset_get_wifi_status(struct adapter *padapter) void sreset_set_wifi_error_status(struct adapter *padapter, u32 status) { - struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); - pHalData->srestpriv.Wifi_Error_Status = status; + padapter->HalData->srestpriv.Wifi_Error_Status = status; } diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c index cce1ea2..c349923 100644 --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c @@ -498,7 +498,7 @@ static u32 array_phy_reg_pg_8188e[] = { static void store_pwrindex_offset(struct adapter *adapter, u32 regaddr, u32 bitmask, u32 data) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapter); + struct hal_data_8188e *hal_data = adapter->HalData; u32 * const power_level_offset = hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt]; @@ -588,11 +588,10 @@ static bool config_bb_with_pgheader(struct adapter *adapt) static void rtl88e_phy_init_bb_rf_register_definition(struct adapter *adapter) { - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapter); struct bb_reg_def *reg[4]; - reg[RF_PATH_A] = _data->PHYRegDef[RF_PATH_A]; - reg[RF_PATH_B] = _data->PHYRegDef[RF_PATH_B]; + reg[RF_PATH_A] = >HalData->PHYRegDef[RF_PATH_A]; + reg[RF_PATH_B] = >HalData->PHYRegDef[RF_PATH_B]; reg[RF_PATH_A]->rfintfs = rFPGA0_XAB_RFInterfaceSW; reg[RF_PATH_B]->rfintfs = rFPGA0_XAB_RFInterfaceSW; @@ -652,13 +651,12 @@ static void rtl88e_phy_init_bb_rf_register_definition(struct adapter *adapter) static bool config_parafile(struct adapter *adapt) { struct eeprom_priv *eeprom = GET_EEPROM_EFUSE_PRIV(adapt); - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); set_baseband_phy_config(adapt); /* If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */ if (!eeprom->bautoload_fail_flag) { - hal_data->pwrGroupCnt = 0; + adapt->HalData->pwrGroupCnt = 0; config_bb_with_pgheader(adapt); } set_baseband_agc_config(adapt); @@ -668,7 +666,6 @@ static bool config_parafile(struct adapter *adapt) bool rtl88eu_phy_bb_config(struct adapter *adapt) { int rtstatus = true; - struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); u32 regval; u8 crystal_cap; @@ -688,7 +685,7 @@ bool rtl88eu_phy_bb_config(struct adapter *adapt) rtstatus = config_parafile(adapt); /* write 0x24[16:11] = 0x24[22:17] = crystal_cap */ - crystal_cap = hal_data->CrystalCap & 0x3F; + crystal_cap = adapt->HalData->CrystalCap & 0x3F; phy_set_bb_reg(adapt, REG_AFE_XTAL_CTRL, 0x7ff800, (crystal_cap | (crystal_cap << 6))); diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c index
[PATCH 10/11] staging: r8188eu: remove GET_RF_TYPE macro
This macro does not used. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index 418bdb9..5362218 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h @@ -353,7 +353,6 @@ struct hal_data_8188e { #define GET_HAL_DATA(__pAdapter) \ ((struct hal_data_8188e *)((__pAdapter)->HalData)) -#define GET_RF_TYPE(priv) (GET_HAL_DATA(priv)->rf_type) /* rtl8188e_hal_init.c */ void _8051Reset88E(struct adapter *padapter); -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/11] staging: r8188eu: remove usb_hal.h
usb_hal.h is empty. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/hal/hal_intf.c| 1 - drivers/staging/rtl8188eu/hal/usb_halinit.c | 1 - drivers/staging/rtl8188eu/include/usb_hal.h | 18 -- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 -- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 - 5 files changed, 23 deletions(-) delete mode 100644 drivers/staging/rtl8188eu/include/usb_hal.h diff --git a/drivers/staging/rtl8188eu/hal/hal_intf.c b/drivers/staging/rtl8188eu/hal/hal_intf.c index 12fde45..a11c7b4 100644 --- a/drivers/staging/rtl8188eu/hal/hal_intf.c +++ b/drivers/staging/rtl8188eu/hal/hal_intf.c @@ -17,7 +17,6 @@ #include #include #include -#include uintrtw_hal_init(struct adapter *adapt) { diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index a3c4334..c4a8f41 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #defineHAL_BB_ENABLE 1 diff --git a/drivers/staging/rtl8188eu/include/usb_hal.h b/drivers/staging/rtl8188eu/include/usb_hal.h deleted file mode 100644 index 3bcf74f..000 --- a/drivers/staging/rtl8188eu/include/usb_hal.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License 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 for - * more details. - * - **/ -#ifndef __USB_HAL_H__ -#define __USB_HAL_H__ - -#endif /* __USB_HAL_H__ */ diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index 79b1755..40691f1 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -23,8 +23,6 @@ #include #include -#include - MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); MODULE_AUTHOR("Realtek Semiconductor Corp."); diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 3da2ab0..b2bc09e 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -25,7 +25,6 @@ #include #include -#include #include #include "rtl8188e_hal.h" -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/11] staging: r8188eu: remove rtl8188eu_set_hal_ops function
rtl8188eu_set_hal_ops only allocates HalData member of adapter structure. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/hal/usb_halinit.c | 7 --- drivers/staging/rtl8188eu/include/usb_hal.h | 2 -- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 7 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index cc27d64..a3c4334 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -2040,10 +2040,3 @@ void rtw_hal_def_value_init(struct adapter *adapt) for (i = 0; i < HP_THERMAL_NUM; i++) haldata->odmpriv.RFCalibrateInfo.ThermalValue_HP[i] = 0; } - -void rtl8188eu_set_hal_ops(struct adapter *adapt) -{ - adapt->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); - if (!adapt->HalData) - DBG_88E("cant not alloc memory for HAL DATA\n"); -} diff --git a/drivers/staging/rtl8188eu/include/usb_hal.h b/drivers/staging/rtl8188eu/include/usb_hal.h index fd9921f..3bcf74f 100644 --- a/drivers/staging/rtl8188eu/include/usb_hal.h +++ b/drivers/staging/rtl8188eu/include/usb_hal.h @@ -15,6 +15,4 @@ #ifndef __USB_HAL_H__ #define __USB_HAL_H__ -void rtl8188eu_set_hal_ops(struct adapter *padapter); - #endif /* __USB_HAL_H__ */ diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index cf33f65..3da2ab0 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -28,6 +28,8 @@ #include #include +#include "rtl8188e_hal.h" + #define USB_VENDER_ID_REALTEK 0x0bda /* DID_USB_v916_20130116 */ @@ -361,8 +363,9 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, padapter->pmondev = pmondev; } - /* step 2. hook HalFunc, allocate HalData */ - rtl8188eu_set_hal_ops(padapter); + padapter->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); + if (!padapter->HalData) + DBG_88E("cant not alloc memory for HAL DATA\n"); padapter->intf_start = _intf_start; padapter->intf_stop = _intf_stop; -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/11] staging: r8188eu: remove xmitframe_direct function
xmitframe_direct is a simple wrapper around rtw_xmitframe_coalesce and rtw_dump_xframe functions. Many wrappers complicates code reading. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c index 5482f47..169d6c8 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c @@ -605,18 +605,6 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp return true; } -static s32 xmitframe_direct(struct adapter *adapt, struct xmit_frame *pxmitframe) -{ - s32 res; - - res = rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe); - if (res == _SUCCESS) - rtw_dump_xframe(adapt, pxmitframe); - else - DBG_88E("==> %s xmitframe_coalsece failed\n", __func__); - return res; -} - /* * Return * truedump packet directly @@ -648,7 +636,12 @@ s32 rtw_hal_xmit(struct adapter *adapt, struct xmit_frame *pxmitframe) pxmitframe->buf_addr = pxmitbuf->pbuf; pxmitbuf->priv_data = pxmitframe; - if (xmitframe_direct(adapt, pxmitframe) != _SUCCESS) { + res = rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe); + + if (res == _SUCCESS) { + rtw_dump_xframe(adapt, pxmitframe); + } else { + DBG_88E("==> %s xmitframe_coalsece failed\n", __func__); rtw_free_xmitbuf(pxmitpriv, pxmitbuf); rtw_free_xmitframe(pxmitpriv, pxmitframe); } -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/11] staging: r8188eu: remove HW_VAR_DM_FLAG member of hw_variables enumeration
rtw_hal_set_hwreg and rtw_hal_get_hwreg does not used with HW_VAR_DM_FLAG parameter. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/hal/usb_halinit.c | 7 --- drivers/staging/rtl8188eu/include/hal_intf.h | 1 - 2 files changed, 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index c4a8f41..897e469 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -1498,9 +1498,6 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 variable, u8 *val) case HW_VAR_SEC_CFG: usb_write8(Adapter, REG_SECCFG, *((u8 *)val)); break; - case HW_VAR_DM_FLAG: - podmpriv->SupportAbility = *((u8 *)val); - break; case HW_VAR_DM_FUNC_OP: if (val[0]) podmpriv->BK_SupportAbility = podmpriv->SupportAbility; @@ -1769,7 +1766,6 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 variable, u8 *val) void rtw_hal_get_hwreg(struct adapter *Adapter, u8 variable, u8 *val) { struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); - struct odm_dm_struct *podmpriv = >odmpriv; switch (variable) { case HW_VAR_BASIC_RATE: @@ -1781,9 +1777,6 @@ void rtw_hal_get_hwreg(struct adapter *Adapter, u8 variable, u8 *val) /* BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2 */ val[0] = (BIT(0) & usb_read8(Adapter, REG_TDECTRL+2)) ? true : false; break; - case HW_VAR_DM_FLAG: - val[0] = podmpriv->SupportAbility; - break; case HW_VAR_RF_TYPE: val[0] = haldata->rf_type; break; diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h b/drivers/staging/rtl8188eu/include/hal_intf.h index 0c0fa35..fa032b0 100644 --- a/drivers/staging/rtl8188eu/include/hal_intf.h +++ b/drivers/staging/rtl8188eu/include/hal_intf.h @@ -58,7 +58,6 @@ enum hw_variables { HW_VAR_SEC_CFG, HW_VAR_BCN_VALID, HW_VAR_RF_TYPE, - HW_VAR_DM_FLAG, HW_VAR_DM_FUNC_OP, HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/11] staging: r8188eu: change last argument type of the usb_write_port function
usb_write_port writes only xmit_buf object data to device. In addition, an appropriate name for this argument is used. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c| 4 ++-- drivers/staging/rtl8188eu/include/usb_ops_linux.h | 2 +- drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 29 +++ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c index 3e6f5ca..5482f47 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c @@ -387,7 +387,7 @@ static s32 rtw_dump_xframe(struct adapter *adapt, struct xmit_frame *pxmitframe) } ff_hwaddr = rtw_get_ff_hwaddr(pxmitframe); - inner_ret = usb_write_port(adapt, ff_hwaddr, w_sz, (unsigned char *)pxmitbuf); + inner_ret = usb_write_port(adapt, ff_hwaddr, w_sz, pxmitbuf); rtw_count_tx_stats(adapt, pxmitframe, sz); @@ -592,7 +592,7 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp /* 3 4. write xmit buffer to USB FIFO */ ff_hwaddr = rtw_get_ff_hwaddr(pfirstframe); - usb_write_port(adapt, ff_hwaddr, pbuf_tail, (u8 *)pxmitbuf); + usb_write_port(adapt, ff_hwaddr, pbuf_tail, pxmitbuf); /* 3 5. update statisitc */ pbuf_tail -= (pfirstframe->agg_num * TXDESC_SIZE); diff --git a/drivers/staging/rtl8188eu/include/usb_ops_linux.h b/drivers/staging/rtl8188eu/include/usb_ops_linux.h index 2207333..fde7753 100644 --- a/drivers/staging/rtl8188eu/include/usb_ops_linux.h +++ b/drivers/staging/rtl8188eu/include/usb_ops_linux.h @@ -75,7 +75,7 @@ int usb_write8(struct adapter *adapter, u32 addr, u8 val); int usb_write16(struct adapter *adapter, u32 addr, u16 val); int usb_write32(struct adapter *adapter, u32 addr, u32 val); -u32 usb_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem); +u32 usb_write_port(struct adapter *adapter, u32 addr, u32 cnt, struct xmit_buf *pmem); void usb_write_port_cancel(struct adapter *adapter); #endif diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c index 9359cc7..52fa659 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c @@ -693,7 +693,7 @@ check_completion: tasklet_hi_schedule(>xmit_tasklet); } -u32 usb_write_port(struct adapter *padapter, u32 addr, u32 cnt, u8 *wmem) +u32 usb_write_port(struct adapter *padapter, u32 addr, u32 cnt, struct xmit_buf *xmitbuf) { unsigned long irqL; unsigned int pipe; @@ -702,8 +702,7 @@ u32 usb_write_port(struct adapter *padapter, u32 addr, u32 cnt, u8 *wmem) struct urb *purb = NULL; struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); struct xmit_priv*pxmitpriv = >xmitpriv; - struct xmit_buf *pxmitbuf = (struct xmit_buf *)wmem; - struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data; + struct xmit_frame *pxmitframe = (struct xmit_frame *)xmitbuf->priv_data; struct usb_device *pusbd = pdvobj->pusbdev; @@ -713,7 +712,7 @@ u32 usb_write_port(struct adapter *padapter, u32 addr, u32 cnt, u8 *wmem) (padapter->pwrctrlpriv.pnp_bstop_trx)) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n")); - rtw_sctx_done_err(>sctx, RTW_SCTX_DONE_TX_DENY); + rtw_sctx_done_err(>sctx, RTW_SCTX_DONE_TX_DENY); goto exit; } @@ -722,44 +721,44 @@ u32 usb_write_port(struct adapter *padapter, u32 addr, u32 cnt, u8 *wmem) switch (addr) { case VO_QUEUE_INX: pxmitpriv->voq_cnt++; - pxmitbuf->flags = VO_QUEUE_INX; + xmitbuf->flags = VO_QUEUE_INX; break; case VI_QUEUE_INX: pxmitpriv->viq_cnt++; - pxmitbuf->flags = VI_QUEUE_INX; + xmitbuf->flags = VI_QUEUE_INX; break; case BE_QUEUE_INX: pxmitpriv->beq_cnt++; - pxmitbuf->flags = BE_QUEUE_INX; + xmitbuf->flags = BE_QUEUE_INX; break; case BK_QUEUE_INX: pxmitpriv->bkq_cnt++; - pxmitbuf->flags = BK_QUEUE_INX; + xmitbuf->flags = BK_QUEUE_INX; break; case HIGH_QUEUE_INX: - pxmitbuf->flags = HIGH_QUEUE_INX; + xmitbuf->flags = HIGH_QUEUE_INX; break; default: - pxmitbuf->flags = MGT_QUEUE_INX; + xmitbuf->flags = MGT_QUEUE_INX; break; }
[PATCH 03/11] staging: r8188eu: remove pkt_hdrlen member of pkt_attrib structure
pkt_hdrlen has a constant value. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/core/rtw_xmit.c| 4 +--- drivers/staging/rtl8188eu/include/rtw_xmit.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index be7fe74..e028ff4 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -511,8 +511,6 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p } pattrib->ack_policy = 0; - /* get ether_hdr_len */ - pattrib->pkt_hdrlen = ETH_HLEN;/* pattrib->ether_type == 0x8100) ? (14 + 4): 14; vlan tag */ pattrib->hdrlen = WLAN_HDR_A3_LEN; pattrib->subtype = WIFI_DATA_TYPE; @@ -995,7 +993,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct } _rtw_open_pktfile(pkt, ); - _rtw_pktfile_read(, NULL, pattrib->pkt_hdrlen); + _rtw_pktfile_read(, NULL, ETH_HLEN); frg_inx = 0; frg_len = pxmitpriv->frag_len - 4;/* 2346-4 = 2342 */ diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h b/drivers/staging/rtl8188eu/include/rtw_xmit.h index cb49aca..dd6b7a9 100644 --- a/drivers/staging/rtl8188eu/include/rtw_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h @@ -113,7 +113,6 @@ struct pkt_attrib { u8 dhcp_pkt; u16 ether_type; u16 seqnum; - u16 pkt_hdrlen; /* the original 802.3 pkt header len */ u16 hdrlen; /* the WLAN Header Len */ u32 pktlen; /* the original 802.3 pkt raw_data len (not include * ether_hdr data) */ -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/11] staging: r8188eu: delete rtw_usb_bulk_size_boundary function
This function does not used. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/include/usb_ops_linux.h | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/usb_ops_linux.h b/drivers/staging/rtl8188eu/include/usb_ops_linux.h index fde7753..78d9b6e 100644 --- a/drivers/staging/rtl8188eu/include/usb_ops_linux.h +++ b/drivers/staging/rtl8188eu/include/usb_ops_linux.h @@ -47,21 +47,6 @@ #define usb_read_interrupt_complete(purb, regs)\ usb_read_interrupt_complete(purb) -static inline u8 rtw_usb_bulk_size_boundary(struct adapter *padapter, - int buf_len) -{ - u8 rst = true; - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); - - if (pdvobjpriv->ishighspeed) - rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE) ? - true : false; - else - rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE) ? - true : false; - return rst; -} - unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr); u8 usb_read8(struct adapter *adapter, u32 addr); -- 2.7.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] rtl8xxxu: Stop log spam from each successful interrupt
Kalle Valowrites: > Jes Sorensen writes: > >> Joe Perches writes: >>> I think it'd be nicer to use dev_dbg for all these cases >>> and as well use some new macro that includes the test >>> >>> Something like: >>> >>> #define rtl8xxxu_dbg(type, fmt, ...)\ >>> do {\ >>> if (rtl8xxxu_debug & (type))\ >>> dev_dbg(dev, fmt, ##__VA_ARGS__); \ >>> } while (0) >> >> Yuck yuck yuck, no thanks! >> >> Any attempt of adding that kinda grossness to the driver will get a >> NACK. > > Huh, how is that ugly? To me it's the opposite, original code is ugly > and Joes' proposal makes sense. Lots of wireless drivers have something > similar. Sorry it's a classic case of obfuscating the code for zero gain. If someone else likes this kinda wrapper in their code, by all means go ahead. In my book it's just bad coding taste. Jes ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] rtl8xxxu: Stop log spam from each successful interrupt
Larry Fingerwrites: > On 09/17/2016 03:59 PM, Jes Sorensen wrote: >> Larry Finger writes: >>> As soon as debugging is turned on, the logs are filled with messages >>> reporting the interrupt status. As this quantity is usually zero, this >>> output is not needed. In fact, there will be a report if the status is >>> not zero, thus the debug line in question could probably be deleted. >>> Rather than taking that action, I have changed it to only be printed >>> when the RTL8XXXU_DEBUG_USB bit is set in the debug mask. >> >> Wrong flag, please add a RTL8XXXU_DEBUG_INTERRUPT flag instead and use >> that. >> >> Which device do you see this with? > > OK. I will change the flag. > > I found this with a TP-Link TL-MN8200ND, which has some variant of the > RTL8188CU chip. It transmits, but I see no evidence that the receiver > is functioning at all. The same is true for driver rtl8192cu. Only the > driver from Realtek's web site actually works. I assume you mean TL-WN8200ND? That device is 'interesting' in the least positive sense of the word. It seems abandoned by the manufacturer too. I have one of them but never managed to get it working, not with any driver under Linux nor Windows. TP-Link shipped a driver disc with it, but you cannot install that in any recent version of Windows because the OS ships with it's own driver for the 8192cu/8188cu series and the device uses the common USB ID. I have been meaning to see if I could find a box with Vista on it to install their driver and run a USB trace on it. > One other problem that I have found is that the debug option on module > load seems to be ignored. So far, I've had to hard wire the > flags. Once I find the reason, I'll send a patch for that as well. That is odd - I use it regularly and haven't had problems with it. Cheers, Jes ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: fixes typo in ks_hostif.c
Fixes typo, FAILUER -> FAILURE Recieve -> Receive Signed-off-by: Hariharan R--- drivers/staging/ks7010/ks_hostif.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index a8822fe..8a18c85 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1231,7 +1231,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) eth_hdr = (struct ether_hdr *)>data[0]; eth_proto = ntohs(eth_hdr->h_proto); - /* for MIC FAILUER REPORT check */ + /* for MIC FAILURE REPORT check */ if (eth_proto == ETHER_PROTOCOL_TYPE_EAP && priv->wpa.mic_failure.failure > 0) { aa1x_hdr = (struct ieee802_1x_hdr *)(eth_hdr + 1); @@ -1284,7 +1284,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) (void *)send_packet_complete, (void *)priv, (void *)packet); - /* MIC FAILUER REPORT check */ + /* MIC FAILURE REPORT check */ if (eth_proto == ETHER_PROTOCOL_TYPE_EAP && priv->wpa.mic_failure.failure > 0) { if (keyinfo & WPA_KEY_INFO_ERROR @@ -1867,7 +1867,7 @@ void hostif_mic_failure_request(struct ks_wlan_private *priv, ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); } -/* Device I/O Recieve indicate */ +/* Device I/O Receive indicate */ static void devio_rec_ind(struct ks_wlan_private *priv, unsigned char *p, unsigned int size) { -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] vme: mark symbols static where possible
We get 4 warnings when building kernel with W=1: drivers/vme/bridges/vme_fake.c:374:6: warning: no previous prototype for 'fake_lm_check' [-Wmissing-prototypes] drivers/vme/bridges/vme_fake.c:609:6: warning: no previous prototype for 'fake_vmewrite8' [-Wmissing-prototypes] drivers/vme/bridges/vme_fake.c:639:6: warning: no previous prototype for 'fake_vmewrite16' [-Wmissing-prototypes] drivers/vme/bridges/vme_fake.c:669:6: warning: no previous prototype for 'fake_vmewrite32' [-Wmissing-prototypes] In fact, these functions are only used in the file in which they are declared and don't need a declaration, but can be made static. so this patch marks these functions with 'static'. Signed-off-by: Baoyou Xie--- drivers/vme/bridges/vme_fake.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c index 7ef298b..37de936 100644 --- a/drivers/vme/bridges/vme_fake.c +++ b/drivers/vme/bridges/vme_fake.c @@ -371,8 +371,8 @@ static int fake_master_get(struct vme_master_resource *image, int *enabled, } -void fake_lm_check(struct fake_driver *bridge, unsigned long long addr, - u32 aspace, u32 cycle) +static void fake_lm_check(struct fake_driver *bridge, unsigned long long addr, + u32 aspace, u32 cycle) { struct vme_bridge *fake_bridge; unsigned long long lm_base; @@ -606,8 +606,8 @@ out: return retval; } -void fake_vmewrite8(struct fake_driver *bridge, u8 *buf, -unsigned long long addr, u32 aspace, u32 cycle) +static void fake_vmewrite8(struct fake_driver *bridge, u8 *buf, + unsigned long long addr, u32 aspace, u32 cycle) { int i; unsigned long long start, end, offset; @@ -636,8 +636,8 @@ void fake_vmewrite8(struct fake_driver *bridge, u8 *buf, } -void fake_vmewrite16(struct fake_driver *bridge, u16 *buf, - unsigned long long addr, u32 aspace, u32 cycle) +static void fake_vmewrite16(struct fake_driver *bridge, u16 *buf, + unsigned long long addr, u32 aspace, u32 cycle) { int i; unsigned long long start, end, offset; @@ -666,8 +666,8 @@ void fake_vmewrite16(struct fake_driver *bridge, u16 *buf, } -void fake_vmewrite32(struct fake_driver *bridge, u32 *buf, - unsigned long long addr, u32 aspace, u32 cycle) +static void fake_vmewrite32(struct fake_driver *bridge, u32 *buf, + unsigned long long addr, u32 aspace, u32 cycle) { int i; unsigned long long start, end, offset; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: lmv: add missing function declaration
We get 1 warning when building kernel with W=1: drivers/staging/lustre/lustre/lmv/lmv_obd.c:2774:5: warning: no previous prototype for 'lmv_pack_md' [-Wmissing-prototypes] In fact, this function is not declared in any file,but should be declared in a header file, thus can be recognized in other file. So this patch adds the declarations into drivers/staging/lustre/lustre/include/lustre_lmv.h. Signed-off-by: Baoyou Xie--- drivers/staging/lustre/lustre/include/lustre_lmv.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/include/lustre_lmv.h b/drivers/staging/lustre/lustre/include/lustre_lmv.h index 085e596..21302c7 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lmv.h +++ b/drivers/staging/lustre/lustre/include/lustre_lmv.h @@ -119,3 +119,5 @@ static inline void lmv_le_to_cpu(union lmv_mds_md *lmv_dst, } +int lmv_pack_md(union lmv_mds_md **lmmp, const struct lmv_stripe_md *lsm, + int stripe_count); #endif -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: move ks_wlan_hw_tx() declaration to header file
We get 1 warning when building kernel with W=1: drivers/staging/ks7010/ks7010_sdio.c:363:5: warning: no previous prototype for 'ks_wlan_hw_tx' [-Wmissing-prototypes] In fact, this function is declared in drivers/staging/ks7010/ks_wlan_net.c and drivers/staging/ks7010/ks_hostif.c, but should be declared in a header file. thus can be recognized in other file. So this patch moves the declaration into drivers/staging/ks7010/ks_wlan.h. Signed-off-by: Baoyou Xie--- drivers/staging/ks7010/ks_hostif.c | 5 - drivers/staging/ks7010/ks_wlan.h | 4 drivers/staging/ks7010/ks_wlan_net.c | 4 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index aacb93e..d8ed3db 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -20,11 +20,6 @@ /* Include Wireless Extension definition and check version */ #include /* New driver API */ -extern int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, -unsigned long size, -void (*complete_handler) (void *arg1, void *arg2), -void *arg1, void *arg2); - extern void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv); extern int ks_wlan_hw_power_save(struct ks_wlan_private *priv); diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h index 936222b..67fd846 100644 --- a/drivers/staging/ks7010/ks_wlan.h +++ b/drivers/staging/ks7010/ks_wlan.h @@ -503,5 +503,9 @@ extern int ks_wlan_net_start(struct net_device *dev); extern int ks_wlan_net_stop(struct net_device *dev); void send_packet_complete(void *, void *); +int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, + unsigned long size, + void (*complete_handler)(void *arg1, void *arg2), + void *arg1, void *arg2); #endif /* _KS_WLAN_H */ diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index a35325e..fe45ba4 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -70,10 +70,6 @@ static const struct iw_handler_def ks_wlan_handler_def; /* * function prototypes */ -extern int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, -unsigned long size, -void (*complete_handler) (void *arg1, void *arg2), -void *arg1, void *arg2); static int ks_wlan_open(struct net_device *dev); static void ks_wlan_tx_timeout(struct net_device *dev); static int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: clean function declarations in ks_hostif.c up
We get 2 warnings when building kernel with W=1: drivers/staging/ks7010/ks7010_sdio.c:152:6: warning: no previous prototype for 'ks_wlan_hw_wakeup_request' [-Wmissing-prototypes] drivers/staging/ks7010/ks7010_sdio.c:255:5: warning: no previous prototype for 'ks_wlan_hw_power_save' [-Wmissing-prototypes] In fact, both functions are declared in drivers/staging/ks7010/ks_hostif.c, but should be declared in a header file, thus can be recognized in other file. So this patch adds the declarations into drivers/staging/ks7010/ks_wlan.h. Signed-off-by: Baoyou Xie--- drivers/staging/ks7010/ks_hostif.c | 3 --- drivers/staging/ks7010/ks_wlan.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index aacb93e..49a81d2 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -25,9 +25,6 @@ extern int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, void (*complete_handler) (void *arg1, void *arg2), void *arg1, void *arg2); -extern void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv); -extern int ks_wlan_hw_power_save(struct ks_wlan_private *priv); - /* macro */ #define inc_smeqhead(priv) \ ( priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE ) diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h index 936222b..54a1531 100644 --- a/drivers/staging/ks7010/ks_wlan.h +++ b/drivers/staging/ks7010/ks_wlan.h @@ -501,6 +501,8 @@ struct ks_wlan_private { extern int ks_wlan_net_start(struct net_device *dev); extern int ks_wlan_net_stop(struct net_device *dev); +void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv); +int ks_wlan_hw_power_save(struct ks_wlan_private *priv); void send_packet_complete(void *, void *); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: clean function declaration in ks_hostif.c up
We get 1 warning when building kernel with W=1: drivers/staging/ks7010/ks_wlan_net.c:3392:6: warning: no previous prototype for 'send_packet_complete' [-Wmissing-prototypes] In fact, this function is declared in drivers/staging/ks7010/ks_hostif.c, but should be declared in a header file. thus can be recognized in other file. So this patch moves the declaration into drivers/staging/ks7010/ks_wlan.h. Signed-off-by: Baoyou Xie--- drivers/staging/ks7010/ks_hostif.c | 1 - drivers/staging/ks7010/ks_wlan.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index c5fc31c..67241c5 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -24,7 +24,6 @@ extern int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, void (*complete_handler) (void *arg1, void *arg2), void *arg1, void *arg2); -extern void send_packet_complete(void *, void *); extern void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv); extern int ks_wlan_hw_power_save(struct ks_wlan_private *priv); diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h index f05dc01..bec918f 100644 --- a/drivers/staging/ks7010/ks_wlan.h +++ b/drivers/staging/ks7010/ks_wlan.h @@ -503,3 +503,5 @@ extern int ks_wlan_net_start(struct net_device *dev); extern int ks_wlan_net_stop(struct net_device *dev); +void send_packet_complete(void *, void *); + #endif /* _KS_WLAN_H */ 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] stagging:iio:ad9834: add devicetree property support
Hi, Thanks for the review. I will send a new patch. Gwenhael On 12/09/2016 14:02, Lars-Peter Clausen wrote: Hi, Thanks for the patch. On 09/11/2016 12:52 PM, Gwenhael Goavec-Merou wrote: +static struct ad9834_platform_data *ad9834_parse_dt(struct spi_device *spi) +{ + struct ad9834_platform_data *pdata; + struct device_node *np = spi->dev.of_node; + + pdata = devm_kzalloc(>dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + if (of_property_read_u32(np, "mclk", >mclk)) + return ERR_PTR(-ENODEV); The input clock should be using the standard clock bindings. + if (of_property_read_u32(np, "freq0", >freq0)) + return ERR_PTR(-ENODEV); + if (of_property_read_u32(np, "freq1", >freq1)) + return ERR_PTR(-ENODEV); + if (of_property_read_u16(np, "phase0", >phase0)) + return ERR_PTR(-ENODEV); + if (of_property_read_u16(np, "phase1", >phase1)) + return ERR_PTR(-ENODEV); + pdata->en_div2 = of_property_read_bool(np, "en_div2"); + pdata->en_signbit_msb_out = of_property_read_bool(np, + "en_signbit_msb_out"); The other attributes seem to be more runtime configuration data, rather than hardware description. Maybe just choose a fixed default. - Lars ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] stagging:iio:ad9834: add devicetree property support
ad9834 driver needs some default properties. Currently these parameters are provided through platform_data. This patch adds a function to create this pdata based on device-tree node. Signed-off-by: Gwenhael Goavec-Merou--- Changes v1 -> v2: - use clock bindings for input clock (Lars-Peter Clausen) - provides a default value for freq0/1 and phase0/1 (Lars-Peter Clausen) --- drivers/staging/iio/frequency/ad9834.c | 71 +- drivers/staging/iio/frequency/ad9834.h | 1 + 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index 6366216..24a3e84 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -316,24 +317,76 @@ static const struct iio_info ad9833_info = { .driver_module = THIS_MODULE, }; +#if defined(CONFIG_OF) +static struct ad9834_platform_data *ad9834_parse_dt(struct spi_device *spi) +{ + struct ad9834_platform_data *pdata; + struct device_node *np = spi->dev.of_node; + + pdata = devm_kzalloc(>dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + pdata->freq0 = 134000; + of_property_read_u32(np, "freq0", >freq0); + + pdata->freq1 = 134000; + of_property_read_u32(np, "freq1", >freq1); + + pdata->phase0 = 0; + of_property_read_u16(np, "phase0", >phase0); + + pdata->phase1 = 0; + of_property_read_u16(np, "phase1", >phase1); + + pdata->en_div2 = of_property_read_bool(np, "en_div2"); + pdata->en_signbit_msb_out = of_property_read_bool(np, + "en_signbit_msb_out"); + + return pdata; +} +#else +static struct ad9834_platform_data *ad9834_parse_dt(struct spi_device *spi) +{ + return NULL; +} +#endif + static int ad9834_probe(struct spi_device *spi) { struct ad9834_platform_data *pdata = dev_get_platdata(>dev); struct ad9834_state *st; struct iio_dev *indio_dev; struct regulator *reg; + struct clk *clk = NULL; int ret; + if (!pdata && spi->dev.of_node) { + pdata = ad9834_parse_dt(spi); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + } + if (!pdata) { dev_dbg(>dev, "no platform data?\n"); return -ENODEV; } + if (!pdata->mclk) { + clk = devm_clk_get(>dev, NULL); + if (IS_ERR(clk)) + return -EPROBE_DEFER; + + ret = clk_prepare_enable(clk); + if (ret < 0) + return ret; + } + reg = devm_regulator_get(>dev, "vcc"); if (!IS_ERR(reg)) { ret = regulator_enable(reg); if (ret) - return ret; + goto error_disable_clk; } indio_dev = devm_iio_device_alloc(>dev, sizeof(*st)); @@ -343,7 +396,14 @@ static int ad9834_probe(struct spi_device *spi) } spi_set_drvdata(spi, indio_dev); st = iio_priv(indio_dev); - st->mclk = pdata->mclk; + + if (clk) { + st->clk = clk; + st->mclk = clk_get_rate(clk); + } else { + st->mclk = pdata->mclk; + } + st->spi = spi; st->devid = spi_get_device_id(spi)->driver_data; st->reg = reg; @@ -418,6 +478,9 @@ static int ad9834_probe(struct spi_device *spi) error_disable_reg: if (!IS_ERR(reg)) regulator_disable(reg); +error_disable_clk: + if (clk) + clk_disable_unprepare(clk); return ret; } @@ -428,6 +491,10 @@ static int ad9834_remove(struct spi_device *spi) struct ad9834_state *st = iio_priv(indio_dev); iio_device_unregister(indio_dev); + + if (st->clk) + clk_disable_unprepare(st->clk); + if (!IS_ERR(st->reg)) regulator_disable(st->reg); diff --git a/drivers/staging/iio/frequency/ad9834.h b/drivers/staging/iio/frequency/ad9834.h index 40fdd5d..fd9cccf 100644 --- a/drivers/staging/iio/frequency/ad9834.h +++ b/drivers/staging/iio/frequency/ad9834.h @@ -53,6 +53,7 @@ struct ad9834_state { struct spi_device *spi; struct regulator*reg; + struct clk *clk; unsigned intmclk; unsigned short control; unsigned short devid; -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] rtl8xxxu: Stop log spam from each successful interrupt
Jes Sorensenwrites: > Joe Perches writes: >> On Sat, 2016-09-17 at 12:09 -0500, Larry Finger wrote: >>> As soon as debugging is turned on, the logs are filled with messages >>> reporting the interrupt status. As this quantity is usually zero, this >>> output is not needed. In fact, there will be a report if the status is >>> not zero, thus the debug line in question could probably be deleted. >>> Rather than taking that action, I have changed it to only be printed >>> when the RTL8XXXU_DEBUG_USB bit is set in the debug mask. >> >> There are many uses of >> if (rtl8xxxu_debug & ) { >> dev_info(dev, ...) >> >> Emitting debugging information at KERN_INFO is odd. > > Not at all, it's a pain to enable it in debug fs post loading the > driver, especially if you need the output immediately during driver > init. That is why the flags are there. > >> I think it'd be nicer to use dev_dbg for all these cases >> and as well use some new macro that includes the test >> >> Something like: >> >> #define rtl8xxxu_dbg(type, fmt, ...) \ >> do { \ >> if (rtl8xxxu_debug & (type))\ >> dev_dbg(dev, fmt, ##__VA_ARGS__); \ >> } while (0) > > Yuck yuck yuck, no thanks! > > Any attempt of adding that kinda grossness to the driver will get a > NACK. Huh, how is that ugly? To me it's the opposite, original code is ugly and Joes' proposal makes sense. Lots of wireless drivers have something similar. -- Kalle Valo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel