From 9e706e8ac8e406270bddf531e133aff65d3e59dc Mon Sep 17 00:00:00 2001 From: tappro Date: Mon, 17 Apr 2006 10:00:11 +0000 Subject: [PATCH] update cmm --- lustre/cmm/cmm_device.c | 34 ++++++++-------------------------- lustre/cmm/cmm_object.c | 22 ++++++++++++++++++---- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/lustre/cmm/cmm_device.c b/lustre/cmm/cmm_device.c index 3a9c8e6..d4f72df 100644 --- a/lustre/cmm/cmm_device.c +++ b/lustre/cmm/cmm_device.c @@ -61,32 +61,26 @@ static struct md_device_operations cmm_md_ops = { .mdo_statfs = cmm_statfs }; -static int cmm_device_init(struct lu_device *d, const char *top) +static int cmm_device_init(struct lu_device *d, struct lu_device *next) { struct cmm_device *m = lu2cmm_dev(d); - struct lu_device *next; - int err; + int err = 0; ENTRY; - LASSERT(m->cmm_child); - next = md2lu_dev(m->cmm_child); + m->cmm_child = lu2md_dev(next); - LASSERT(next->ld_type->ldt_ops->ldto_device_init != NULL); - err = next->ld_type->ldt_ops->ldto_device_init(next, top); RETURN(err); } -static void cmm_device_fini(struct lu_device *d) +static struct lu_device *cmm_device_fini(struct lu_device *d) { struct cmm_device *m = lu2cmm_dev(d); - struct lu_device *next; + struct lu_device *next = md2lu_dev(m->cmm_child); - LASSERT(m->cmm_child); - next = md2lu_dev(m->cmm_child); - - LASSERT(next->ld_type->ldt_ops->ldto_device_fini != NULL); - next->ld_type->ldt_ops->ldto_device_fini(next); + ENTRY; + EXIT; + return next; } static struct lu_device_operations cmm_lu_ops = { @@ -102,8 +96,6 @@ struct lu_device *cmm_device_alloc(struct lu_device_type *t, { struct lu_device *l; struct cmm_device *m; - struct obd_device * obd = NULL; - char * child = lustre_cfg_string(cfg, 1); ENTRY; @@ -115,16 +107,6 @@ struct lu_device *cmm_device_alloc(struct lu_device_type *t, m->cmm_md_dev.md_ops = &cmm_md_ops; l = cmm2lu_dev(m); l->ld_ops = &cmm_lu_ops; - - /* get next layer */ - obd = class_name2obd(child); - if (obd && obd->obd_lu_dev) { - CDEBUG(D_INFO, "Child device is %s\n", child); - m->cmm_child = lu2md_dev(obd->obd_lu_dev); - } else { - CDEBUG(D_INFO, "Child device %s not found\n", child); - l = ERR_PTR(-EINVAL); - } } EXIT; diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 06fe7ef..662b08b 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -36,7 +36,8 @@ static struct md_object_operations cmm_mo_ops; -struct lu_object *cmm_object_alloc(struct lu_context *ctx, struct lu_device *d) +struct lu_object *cmm_object_alloc(struct lu_context *ctx, + struct lu_device *d) { struct cmm_object *mo; ENTRY; @@ -58,10 +59,21 @@ int cmm_object_init(struct lu_context *ctxt, struct lu_object *o) struct cmm_device *d = lu2cmm_dev(o->lo_dev); struct lu_device *under; struct lu_object *below; + //struct lu_fid *fid = &o->lo_header->loh_fid; + //int mds_index; ENTRY; - - under = &d->cmm_child->md_lu_dev; - below = under->ld_ops->ldo_object_alloc(ctxt, under); + + /* under device can be MDD or MDC */ +#if 0 + mds = cmm_fld_lookup(fid); + if (mds_index != d->local_index) + under = &d->cmm_lmv->md_lu_dev; + else +#endif + under = &d->cmm_child->md_lu_dev; + + + below = under->ld_ops->ldo_object_alloc(ctxt, under); if (below != NULL) { lu_object_add(o, below); RETURN(0); @@ -71,7 +83,9 @@ int cmm_object_init(struct lu_context *ctxt, struct lu_object *o) void cmm_object_free(struct lu_context *ctx, struct lu_object *o) { + struct cmm_object *mo = lu2cmm_obj(o); lu_object_fini(o); + OBD_FREE_PTR(mo); } void cmm_object_release(struct lu_context *ctxt, struct lu_object *o) -- 1.8.3.1