From bab7c8998a6539c0d5e054f9a5fd4ecb2a6d9c56 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Thu, 2 Sep 2021 23:44:57 +0800 Subject: [PATCH] LU-8238 ldlm: rid of obsolete param of ldlm_resource_get() The second parameter @parent of ldlm_resource_get() is obsolete, just remove it. Test-Parameters: trivial Change-Id: I88af99c6984eda50a21da4d516ce7dea8cba60f5 Signed-off-by: Bobi Jam Reviewed-on: https://review.whamcloud.com/20631 Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/include/lustre_dlm.h | 1 - lustre/ldlm/ldlm_extent.c | 2 +- lustre/ldlm/ldlm_lock.c | 6 +++--- lustre/ldlm/ldlm_request.c | 4 ++-- lustre/ldlm/ldlm_resource.c | 6 ++---- lustre/mdc/mdc_dev.c | 5 +++-- lustre/mdc/mdc_locks.c | 2 +- lustre/mdc/mdc_reint.c | 2 +- lustre/mdt/mdt_io.c | 8 +++----- lustre/mgs/mgs_barrier.c | 2 +- lustre/ofd/ofd_dev.c | 10 ++++------ lustre/ofd/ofd_io.c | 2 +- lustre/ofd/ofd_obd.c | 3 +-- lustre/osc/osc_object.c | 6 +++--- lustre/osc/osc_request.c | 2 +- lustre/quota/qmt_lock.c | 5 ++--- 16 files changed, 29 insertions(+), 37 deletions(-) diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index dc738f4..8fc8127 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -1668,7 +1668,6 @@ static inline void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req, /* resource.c - internal */ struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns, - struct ldlm_resource *parent, const struct ldlm_res_id *, enum ldlm_type type, int create); struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res); diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index 7d8e5e2..ff40ece 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -698,7 +698,7 @@ void ldlm_resource_prolong(struct ldlm_prolong_args *arg) ENTRY; - res = ldlm_resource_get(arg->lpa_export->exp_obd->obd_namespace, NULL, + res = ldlm_resource_get(arg->lpa_export->exp_obd->obd_namespace, &arg->lpa_resid, LDLM_EXTENT, 0); if (IS_ERR(res)) { CDEBUG(D_DLMTRACE, "Failed to get resource for resid %llu/%llu\n", diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 3ceadc9..2830412 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -536,7 +536,7 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock, type = oldres->lr_type; unlock_res_and_lock(lock); - newres = ldlm_resource_get(ns, NULL, new_resid, type, 1); + newres = ldlm_resource_get(ns, new_resid, type, 1); if (IS_ERR(newres)) RETURN(PTR_ERR(newres)); @@ -1438,7 +1438,7 @@ enum ldlm_mode ldlm_lock_match_with_skip(struct ldlm_namespace *ns, *data.lmd_mode = data.lmd_old->l_req_mode; } - res = ldlm_resource_get(ns, NULL, res_id, type, 0); + res = ldlm_resource_get(ns, res_id, type, 0); if (IS_ERR(res)) { LASSERT(data.lmd_old == NULL); RETURN(0); @@ -1667,7 +1667,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, int rc; ENTRY; - res = ldlm_resource_get(ns, NULL, res_id, type, 1); + res = ldlm_resource_get(ns, res_id, type, 1); if (IS_ERR(res)) RETURN(ERR_CAST(res)); diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 048f5c3..02deec2 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -2187,7 +2187,7 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns, ENTRY; - res = ldlm_resource_get(ns, NULL, res_id, 0, 0); + res = ldlm_resource_get(ns, res_id, 0, 0); if (IS_ERR(res)) { /* This is not a problem. */ CDEBUG(D_INFO, "No resource %llu\n", res_id->name[0]); @@ -2342,7 +2342,7 @@ int ldlm_resource_iterate(struct ldlm_namespace *ns, LASSERTF(ns != NULL, "must pass in namespace\n"); - res = ldlm_resource_get(ns, NULL, res_id, 0, 0); + res = ldlm_resource_get(ns, res_id, 0, 0); if (IS_ERR(res)) RETURN(0); diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index 3360fa5..b00579e 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -1481,9 +1481,8 @@ static void ldlm_resource_free(struct ldlm_resource *res) * Returns: referenced, unlocked ldlm_resource or ERR_PTR */ struct ldlm_resource * -ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, - const struct ldlm_res_id *name, enum ldlm_type type, - int create) +ldlm_resource_get(struct ldlm_namespace *ns, const struct ldlm_res_id *name, + enum ldlm_type type, int create) { struct hlist_node *hnode; struct ldlm_resource *res = NULL; @@ -1493,7 +1492,6 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, int hash; LASSERT(ns != NULL); - LASSERT(parent == NULL); LASSERT(ns->ns_rs_hash != NULL); LASSERT(name->name[0] != 0); diff --git a/lustre/mdc/mdc_dev.c b/lustre/mdc/mdc_dev.c index 2705461..563187e 100644 --- a/lustre/mdc/mdc_dev.c +++ b/lustre/mdc/mdc_dev.c @@ -1025,8 +1025,9 @@ static int mdc_get_lock_handle(const struct lu_env *env, struct osc_object *osc, resname = &osc_env_info(env)->oti_resname; fid_build_reg_res_name(lu_object_fid(osc2lu(osc)), resname); - res = ldlm_resource_get(osc_export(osc)->exp_obd->obd_namespace, - NULL, resname, LDLM_IBITS, 0); + res = ldlm_resource_get(osc_export(osc)-> + exp_obd->obd_namespace, + resname, LDLM_IBITS, 0); if (IS_ERR(res)) CERROR("No lock resource for "DFID"\n", PFID(lu_object_fid(osc2lu(osc)))); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 41692b3..8612405 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -176,7 +176,7 @@ int mdc_null_inode(struct obd_export *exp, fid_build_reg_res_name(fid, &res_id); - res = ldlm_resource_get(ns, NULL, &res_id, 0, 0); + res = ldlm_resource_get(ns, &res_id, 0, 0); if (IS_ERR(res)) RETURN(0); diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index f75d559..4d76294 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -80,7 +80,7 @@ int mdc_resource_get_unused_res(struct obd_export *exp, if (exp_connect_cancelset(exp) && !ns_connect_cancelset(ns)) RETURN(0); - res = ldlm_resource_get(ns, NULL, res_id, 0, 0); + res = ldlm_resource_get(ns, res_id, 0, 0); if (IS_ERR(res)) RETURN(0); LDLM_RESOURCE_ADDREF(res); diff --git a/lustre/mdt/mdt_io.c b/lustre/mdt/mdt_io.c index 38b7ad1..8858135 100644 --- a/lustre/mdt/mdt_io.c +++ b/lustre/mdt/mdt_io.c @@ -65,7 +65,7 @@ static void mdt_dom_resource_prolong(struct ldlm_prolong_args *arg) ENTRY; - res = ldlm_resource_get(arg->lpa_export->exp_obd->obd_namespace, NULL, + res = ldlm_resource_get(arg->lpa_export->exp_obd->obd_namespace, &arg->lpa_resid, LDLM_IBITS, 0); if (IS_ERR(res)) { CDEBUG(D_DLMTRACE, @@ -713,8 +713,7 @@ void mdt_dom_obj_lvb_update(const struct lu_env *env, struct mdt_object *mo, struct ldlm_resource *res; fid_build_reg_res_name(mdt_object_fid(mo), &resid); - res = ldlm_resource_get(mdt->mdt_namespace, NULL, &resid, - LDLM_IBITS, 1); + res = ldlm_resource_get(mdt->mdt_namespace, &resid, LDLM_IBITS, 1); if (IS_ERR(res)) return; @@ -1341,8 +1340,7 @@ int mdt_dom_object_size(const struct lu_env *env, struct mdt_device *mdt, ENTRY; fid_build_reg_res_name(fid, &resid); - res = ldlm_resource_get(mdt->mdt_namespace, NULL, &resid, - LDLM_IBITS, 1); + res = ldlm_resource_get(mdt->mdt_namespace, &resid, LDLM_IBITS, 1); if (IS_ERR(res)) RETURN(-ENOENT); diff --git a/lustre/mgs/mgs_barrier.c b/lustre/mgs/mgs_barrier.c index c419421..bf8a725 100644 --- a/lustre/mgs/mgs_barrier.c +++ b/lustre/mgs/mgs_barrier.c @@ -133,7 +133,7 @@ static int mgs_barrier_glimpse_lock(const struct lu_env *env, if (rc) RETURN(rc); - res = ldlm_resource_get(mgs->mgs_obd->obd_namespace, NULL, &res_id, + res = ldlm_resource_get(mgs->mgs_obd->obd_namespace, &res_id, LDLM_PLAIN, 0); if (IS_ERR(res)) RETURN(PTR_ERR(res)); diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 48ac842..6b9ea6e 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1379,8 +1379,8 @@ out: * otherwise concurrent destroy can make the object unavailable * for 2nd lu_object_find() waiting for the first reference * to go... deadlock! */ - res = ldlm_resource_get(ofd->ofd_namespace, NULL, - &tsi->tsi_resid, LDLM_EXTENT, 0); + res = ldlm_resource_get(ofd->ofd_namespace, &tsi->tsi_resid, + LDLM_EXTENT, 0); if (!IS_ERR(res)) { ldlm_res_lvbo_update(res, NULL, 0); ldlm_resource_putref(res); @@ -2071,8 +2071,7 @@ out: if (srvlock) tgt_data_unlock(&lh, LCK_PW); if (rc == 0) { - res = ldlm_resource_get(ns, NULL, &tsi->tsi_resid, - LDLM_EXTENT, 0); + res = ldlm_resource_get(ns, &tsi->tsi_resid, LDLM_EXTENT, 0); if (!IS_ERR(res)) { struct ost_lvb *res_lvb; @@ -2188,8 +2187,7 @@ out: * otherwise concurrent destroy can make the object unavailable * for 2nd lu_object_find() waiting for the first reference * to go... deadlock! */ - res = ldlm_resource_get(ns, NULL, &tsi->tsi_resid, - LDLM_EXTENT, 0); + res = ldlm_resource_get(ns, &tsi->tsi_resid, LDLM_EXTENT, 0); if (!IS_ERR(res)) { struct ost_lvb *res_lvb; diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 71fe365..a620aa1 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -1529,7 +1529,7 @@ int ofd_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp, */ if (rc == 0 && (rnb[0].rnb_flags & OBD_BRW_SRVLOCK)) { ost_fid_build_resid(fid, &info->fti_resid); - rs = ldlm_resource_get(ns, NULL, &info->fti_resid, + rs = ldlm_resource_get(ns, &info->fti_resid, LDLM_EXTENT, 0); if (!IS_ERR(rs)) { ldlm_res_lvbo_update(rs, NULL, 1); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 67ebade..1414050 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -885,8 +885,7 @@ out: * for 2nd lu_object_find() waiting for the first reference * to go... deadlock! */ - res = ldlm_resource_get(ns, NULL, &info->fti_resid, - LDLM_EXTENT, 0); + res = ldlm_resource_get(ns, &info->fti_resid, LDLM_EXTENT, 0); if (!IS_ERR(res)) { ldlm_res_lvbo_update(res, NULL, 0); ldlm_resource_putref(res); diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index 64f6b94..ea1d290 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -398,9 +398,9 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, resname = &osc_env_info(env)->oti_resname; ostid_build_res_name(&oinfo->loi_oi, resname); - res = ldlm_resource_get( - osc_export(cl2osc(obj))->exp_obd->obd_namespace, - NULL, resname, LDLM_EXTENT, 0); + res = ldlm_resource_get(osc_export(cl2osc(obj))-> + exp_obd->obd_namespace, + resname, LDLM_EXTENT, 0); if (IS_ERR(res)) CERROR("No lock resource\n"); else diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index abf2fcc..5847bf2 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -582,7 +582,7 @@ static int osc_resource_get_unused(struct obd_export *exp, struct obdo *oa, RETURN(0); ostid_build_res_name(&oa->o_oi, &res_id); - res = ldlm_resource_get(ns, NULL, &res_id, 0, 0); + res = ldlm_resource_get(ns, &res_id, 0, 0); if (IS_ERR(res)) RETURN(0); diff --git a/lustre/quota/qmt_lock.c b/lustre/quota/qmt_lock.c index 49421e3..5ee05c2 100644 --- a/lustre/quota/qmt_lock.c +++ b/lustre/quota/qmt_lock.c @@ -810,7 +810,7 @@ void qmt_glb_lock_notify(const struct lu_env *env, struct lquota_entry *lqe, /* look up ldlm resource associated with global index */ fid_build_reg_res_name(&qti->qti_fid, &qti->qti_resid); - res = ldlm_resource_get(pool->qpi_qmt->qmt_ns, NULL, &qti->qti_resid, + res = ldlm_resource_get(pool->qpi_qmt->qmt_ns, &qti->qti_resid, LDLM_PLAIN, 0); if (IS_ERR(res)) { /* this might happen if no slaves have enqueued global quota @@ -869,8 +869,7 @@ static void qmt_id_lock_glimpse(const struct lu_env *env, lquota_generate_fid(&qti->qti_fid, pool->qpi_rtype, lqe_qtype(lqe)); fid_build_quota_res_name(&qti->qti_fid, &lqe->lqe_id, &qti->qti_resid); - res = ldlm_resource_get(qmt->qmt_ns, NULL, &qti->qti_resid, LDLM_PLAIN, - 0); + res = ldlm_resource_get(qmt->qmt_ns, &qti->qti_resid, LDLM_PLAIN, 0); if (IS_ERR(res)) { /* this might legitimately happens if slaves haven't had the * opportunity to enqueue quota lock yet. */ -- 1.8.3.1