From 3399054132a7c6d7e7c115acb0d0cd0123edaa8d Mon Sep 17 00:00:00 2001 From: nikita Date: Thu, 21 Sep 2006 10:46:23 +0000 Subject: [PATCH] move lprocfs_obd_cleanup() to lu_device_fini() to share the code --- lustre/mdt/mdt_handler.c | 8 +------- lustre/obdclass/lu_object.c | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index e0f0018..c6bcd03 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2923,7 +2923,6 @@ out: static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m) { - struct obd_device *obd = m->mdt_md_dev.md_lu_dev.ld_obd; struct lu_device *d = &m->mdt_md_dev.md_lu_dev; struct lu_site *ls = d->ld_site; @@ -2943,9 +2942,6 @@ static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m) mdt_fs_cleanup(ctx, m); - /* finish lprocfs */ - lprocfs_obd_cleanup(obd); - /* finish the stack */ mdt_stack_fini(ctx, m, md2lu_dev(m->mdt_child)); @@ -3020,7 +3016,7 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m, rc = mdt_stack_init(ctx, m, cfg); if (rc) { CERROR("can't init device stack, rc %d\n", rc); - GOTO(err_fini_lprocfs, rc); + GOTO(err_fini_site, rc); } /* set server index */ @@ -3067,8 +3063,6 @@ err_fini_fld: mdt_fld_fini(ctx, m); err_fini_stack: mdt_stack_fini(ctx, m, md2lu_dev(m->mdt_child)); -err_fini_lprocfs: - lprocfs_obd_cleanup(obd); err_fini_site: lu_site_fini(s); err_free_site: diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 99c436d..e24d976 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -574,6 +574,10 @@ EXPORT_SYMBOL(lu_device_init); */ void lu_device_fini(struct lu_device *d) { + if (d->ld_obd != NULL) + /* finish lprocfs */ + lprocfs_obd_cleanup(d->ld_obd); + LASSERTF(atomic_read(&d->ld_ref) == 0, "Refcount is %u\n", atomic_read(&d->ld_ref)); } -- 1.8.3.1