From b3a587cd98f6befe3001619c35aed6bb713155d7 Mon Sep 17 00:00:00 2001 From: yury Date: Mon, 30 Oct 2006 16:19:24 +0000 Subject: [PATCH] - use usual MDT name in mdd procfs stuff instead of mdd-0; - make mdc/mdc_is_subdir() static to not confuse it with same name in cmm. --- lustre/mdc/mdc_request.c | 5 ++--- lustre/mdd/mdd_device.c | 6 +++--- lustre/mdd/mdd_internal.h | 2 +- lustre/mdd/mdd_lproc.c | 21 +++++++++------------ 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 418bb1be..d02392d 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -301,9 +301,8 @@ int mdc_getattr_name(struct obd_export *exp, const struct lu_fid *fid, RETURN(rc); } -int mdc_is_subdir(struct obd_export *exp, const struct lu_fid *pfid, - const struct lu_fid *cfid, - struct ptlrpc_request **request) +static int mdc_is_subdir(struct obd_export *exp, const struct lu_fid *pfid, + const struct lu_fid *cfid, struct ptlrpc_request **request) { int size[2] = { sizeof(struct ptlrpc_body), sizeof(struct mdt_body) }; diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index f67c6b2..7f7b6d6 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -56,14 +56,14 @@ static int mdd_device_init(const struct lu_env *env, struct lu_device *d, ENTRY; mdd->mdd_child = lu2dt_dev(next); - dt = mdd->mdd_child; - /* prepare transactions callbacks */ + + /* Prepare transactions callbacks. */ mdd->mdd_txn_cb.dtc_txn_start = mdd_txn_start_cb; mdd->mdd_txn_cb.dtc_txn_stop = mdd_txn_stop_cb; mdd->mdd_txn_cb.dtc_txn_commit = mdd_txn_commit_cb; mdd->mdd_txn_cb.dtc_cookie = mdd; - rc = mdd_procfs_init(mdd); + rc = mdd_procfs_init(mdd, name); RETURN(rc); } diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index dba4de2..2f1e990 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -211,7 +211,7 @@ int orph_index_init(const struct lu_env *env, struct mdd_device *mdd); void orph_index_fini(const struct lu_env *env, struct mdd_device *mdd); int mdd_txn_init_credits(const struct lu_env *env, struct mdd_device *mdd); -int mdd_procfs_init(struct mdd_device *mdd); +int mdd_procfs_init(struct mdd_device *mdd, const char *name); int mdd_procfs_fini(struct mdd_device *mdd); void mdd_lproc_time_start(struct mdd_device *mdd, struct timeval *start, int op); diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c index 2bf5f0c..670b381 100644 --- a/lustre/mdd/mdd_lproc.c +++ b/lustre/mdd/mdd_lproc.c @@ -98,38 +98,35 @@ int mdd_procfs_fini(struct mdd_device *mdd) RETURN(0); } -int mdd_procfs_init(struct mdd_device *mdd) +int mdd_procfs_init(struct mdd_device *mdd, const char *name) { struct lu_device *ld = &mdd->mdd_md_dev.md_lu_dev; struct obd_type *type; - char mdd_name[10]; - int rc = 0; + int rc; ENTRY; type = ld->ld_type->ldt_obd_type; + LASSERT(name != NULL); LASSERT(type != NULL); - memset(mdd_name, 0, sizeof(mdd_name)); - snprintf(mdd_name, strlen(LUSTRE_MDD_NAME) + 5, "%s-%d", - LUSTRE_MDD_NAME, (int)ld->ld_site->ls_node_id); - - /* find the type procroot and add the proc entry for this device */ - mdd->mdd_proc_entry = lprocfs_register(mdd_name, type->typ_procroot, + /* Find the type procroot and add the proc entry for this device */ + mdd->mdd_proc_entry = lprocfs_register(name, type->typ_procroot, NULL, NULL); if (IS_ERR(mdd->mdd_proc_entry)) { rc = PTR_ERR(mdd->mdd_proc_entry); - CERROR("error %d setting up lprocfs for %s\n", - rc, mdd_name); + CERROR("Error %d setting up lprocfs for %s\n", + rc, name); mdd->mdd_proc_entry = NULL; GOTO(out, rc); } rc = mdd_procfs_init_stats(mdd, LPROC_MDD_LAST); + EXIT; out: if (rc) mdd_procfs_fini(mdd); - RETURN(rc); + return rc; } void mdd_lproc_time_start(struct mdd_device *mdd, struct timeval *start, int op) -- 1.8.3.1