.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 = {
{
struct lu_device *l;
struct cmm_device *m;
- struct obd_device * obd = NULL;
- char * child = lustre_cfg_string(cfg, 1);
ENTRY;
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;
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;
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);
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)