X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosp%2Fosp_dev.c;h=9a66737bc033d838435b22fa0f9863c16df0b315;hp=6ec6216e699966d2afb841849c4810456d3c5d03;hb=f4547f0569774eb794fb143362e201f658415f4c;hpb=1bdf0d6fcbe11efdf67ebdb09f04955b9ce88de4;ds=sidebyside diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index 6ec6216..9a66737 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -72,20 +72,28 @@ struct lu_object *osp_object_alloc(const struct lu_env *env, const struct lu_object_header *hdr, struct lu_device *d) { - struct lu_object_header *h; + struct lu_object_header *h = NULL; struct osp_object *o; struct lu_object *l; - LASSERT(hdr == NULL); - OBD_SLAB_ALLOC_PTR_GFP(o, osp_object_kmem, CFS_ALLOC_IO); if (o != NULL) { l = &o->opo_obj.do_lu; - h = &o->opo_header; - lu_object_header_init(h); - dt_object_init(&o->opo_obj, h, d); - lu_object_add_top(h, l); + /* For data object, OSP obj would always be the top + * object, i.e. hdr is always NULL, see lu_object_alloc. + * But for metadata object, we always build the object + * stack from MDT. i.e. mdt_object will be the top object + * i.e. hdr != NULL */ + if (hdr == NULL) { + /* object for OST */ + h = &o->opo_header; + lu_object_header_init(h); + dt_object_init(&o->opo_obj, h, d); + lu_object_add_top(h, l); + } else { + dt_object_init(&o->opo_obj, h, d); + } l->lo_ops = &osp_lu_obj_ops; @@ -372,6 +380,9 @@ static int osp_process_config(const struct lu_env *env, ENTRY; switch (lcfg->lcfg_command) { + case LCFG_PRE_CLEANUP: + rc = osp_disconnect(d); + break; case LCFG_CLEANUP: lu_dev_del_linkage(dev->ld_site, dev); rc = osp_shutdown(env, d); @@ -480,6 +491,8 @@ static int osp_sync(const struct lu_env *env, struct dt_device *dev) const struct dt_device_operations osp_dt_ops = { .dt_statfs = osp_statfs, .dt_sync = osp_sync, + .dt_trans_start = osp_trans_start, + .dt_trans_stop = osp_trans_stop, }; static int osp_connect_to_osd(const struct lu_env *env, struct osp_device *m, @@ -720,7 +733,7 @@ out_last_used: out_proc: ptlrpc_lprocfs_unregister_obd(obd); lprocfs_obd_cleanup(obd); - class_destroy_import(obd->u.cli.cl_import); + obd_cleanup_client_import(obd); client_obd_cleanup(obd); out_ref: ptlrpcd_decref();