Whamcloud - gitweb
update cmm-mdc code
authortappro <tappro>
Fri, 9 Jun 2006 11:32:11 +0000 (11:32 +0000)
committertappro <tappro>
Fri, 9 Jun 2006 11:32:11 +0000 (11:32 +0000)
lustre/cmm/cmm_object.c
lustre/cmm/mdc_device.c
lustre/cmm/mdc_internal.h
lustre/cmm/mdc_object.c

index 1228b95..f04e9dd 100644 (file)
@@ -467,7 +467,7 @@ static int cmr_object_create(const struct lu_context *ctx,
 static int cmr_attr_get(const struct lu_context *ctx, struct md_object *mo,
                         struct lu_attr *attr)
 {
-        RETURN(-EFAULT);
+        RETURN(-EREMOTE);
 }
 
 static int cmr_attr_set(const struct lu_context *ctx, struct md_object *mo,
@@ -500,7 +500,7 @@ static int cmr_ref_del(const struct lu_context *ctx, struct md_object *mo)
 
 static int cmr_open(const struct lu_context *ctx, struct md_object *mo)
 {
-        RETURN(-EFAULT);
+        RETURN(-EREMOTE);
 }
 
 static int cmr_close(const struct lu_context *ctx, struct md_object *mo)
@@ -592,7 +592,8 @@ static int cmr_rename(const struct lu_context *ctx, struct md_object *mo_po,
                         cmm2child_obj(md2cmm_obj(mo_t)), t_name);
         
         if (mo_t == NULL) { 
-                rc = mdo_name_insert(ctx, c_pn, t_name, lu_object_fid(c_s->mo_lu));
+                rc = mdo_name_insert(ctx, c_pn, t_name,
+                                     lu_object_fid(&c_s->mo_lu));
                 rc = mdo_name_remove(ctx, c_po, s_name); 
         } else {
                 c_t =  cmm2child_obj(md2cmm_obj(mo_t));
index 67a60d7..41a20ff 100644 (file)
@@ -48,6 +48,200 @@ static inline int lu_device_is_mdc(struct lu_device *ld)
                     ld->ld_ops == &mdc_lu_ops);
 }
 
+#ifdef CMM_CODE
+static struct md_device_operations mdc_md_ops = { 0 };
+
+static int mdc_add_obd(struct mdc_device *mc, struct lustre_cfg *cfg)
+{
+        struct mdc_cli_desc *desc = &mc->mc_desc;
+        struct obd_device *mdc, *mdt;
+        const char *srv = lustre_cfg_string(cfg, 0);
+        const char *uuid_str = lustre_cfg_string(cfg, 1);
+        const char *index = lustre_cfg_string(cfg, 2);
+        int rc = 0;
+
+        ENTRY;
+
+        //find mdt obd to get group uuid
+        mdt = class_name2obd(srv);
+        if (mdt == NULL) {
+                CERROR("No such OBD %s\n", srv);
+                LBUG();
+        }
+        obd_str2uuid(&desc->mc_cli_uuid, uuid_str);
+        mdc = class_find_client_obd(&desc->mc_cli_uuid, LUSTRE_MDC_NAME,
+                                    &mdt->obd_uuid);
+        if (!mdc) {
+                CERROR("Cannot find MDC OBD connected to %s\n", uuid_str);
+                rc = -ENOENT;
+        } else if (!mdc->obd_set_up) {
+                CERROR("target %s not set up\n", mdc->obd_name);
+                rc = -EINVAL;
+        } else {
+                struct lustre_handle conn = {0, };
+
+                CDEBUG(D_CONFIG, "connect to %s(%s)\n",
+                       mdc->obd_name, mdc->obd_uuid.uuid);
+
+                rc = obd_connect(&conn, mdc, &mdt->obd_uuid, NULL);
+
+                if (rc) {
+                        CERROR("target %s connect error %d\n",
+                               mdc->obd_name, rc);
+                } else {
+                        desc->cl_exp = class_conn2export(&conn);
+                        mc->mc_num = simple_strtol(index, NULL, 10);
+                }
+        }
+
+        RETURN(rc);
+}
+
+static int mdc_del_obd(struct mdc_device *mc)
+{
+        struct mdc_cli_desc *desc = &mc->mc_desc;
+        int rc;
+
+        ENTRY;
+
+        CDEBUG(D_CONFIG, "disconnect from %s(%s)\n",
+               mdc->obd_name, mdc->obd_uuid.uuid);
+
+        rc = obd_disconnect(desc->cli_exp);
+        if (rc) {
+                CERROR("target %s disconnect error %d\n",
+                       class_exp2obd(desc->cl_exp)->obd_name, rc);
+        }
+        desc->cl_exp = NULL;
+
+        RETURN(rc);
+}
+
+static int mdc_process_config(const struct lu_context *ctx,
+                              struct lu_device *ld, struct lustre_cfg *cfg)
+{
+        struct mdc_device *mc = lu2mdc_dev(ld);
+        int rc;
+
+        ENTRY;
+        switch (cfg->lcfg_command) {
+        case LCFG_ADD_MDC:
+                rc = mdc_add_obd(mc, cfg);
+                break;
+        default:
+                rc = -EOPNOTSUPP;
+        }
+        RETURN(rc);
+}
+
+static struct lu_device_operations mdc_lu_ops = {
+       .ldo_object_alloc   = mdc_object_alloc,
+        .ldo_process_config = mdc_process_config
+};
+
+static int mdc_device_init(const struct lu_context *ctx,
+                           struct lu_device *ld, struct lu_device *next)
+{
+        return 0;
+}
+
+static struct lu_device *mdc_device_fini(const struct lu_context *ctx,
+                                         struct lu_device *ld)
+{
+       struct mdc_device *mc = lu2mdc_dev(ld);
+        //TODO: disconnect from MDC OBD, finalize all other things.
+        ENTRY;
+
+        mdc_del_obd(mc);
+
+        RETURN (NULL);
+}
+
+struct lu_device *mdc_device_alloc(const struct lu_context *ctx,
+                                   struct lu_device_type *ldt,
+                                   struct lustre_cfg *cfg)
+{
+        struct lu_device  *ld;
+        struct mdc_device *mc;
+
+        ENTRY;
+
+        OBD_ALLOC_PTR(mc);
+        if (mc == NULL) {
+                ld = ERR_PTR(-ENOMEM);
+        } else {
+                md_device_init(&mc->mc_md_dev, ldt);
+                mc->mc_md_dev.md_ops =  &mdc_md_ops;
+               ld = mdc2lu_dev(mc);
+                ld->ld_ops = &mdc_lu_ops;
+        }
+
+        RETURN (ld);
+}
+void mdc_device_free(const struct lu_context *ctx, struct lu_device *ld)
+{
+        struct mdc_device *mc = lu2mdc_dev(ld);
+
+       LASSERT(atomic_read(&ld->ld_ref) == 0);
+       md_device_fini(&mc->mc_md_dev);
+        OBD_FREE_PTR(mc);
+}
+
+/* context key constructor/destructor */
+
+static void *mdÓ_thread_init(const struct lu_context *ctx,
+                             struct lu_context_key *key)
+{
+        struct mdÓ_thread_info *info;
+
+        CLASSERT(CFS_PAGE_SIZE >= sizeof *info);
+        OBD_ALLOC_PTR(info);
+        if (info != NULL)
+                info->mci_ctxt = ctx;
+        else
+                info = ERR_PTR(-ENOMEM);
+        return info;
+}
+
+static void mdc_thread_fini(const struct lu_context *ctx,
+                            struct lu_context_key *key, void *data)
+{
+        struct mdc_thread_info *info = data;
+        OBD_FREE_PTR(info);
+}
+
+struct lu_context_key mdc_thread_key = {
+        .lct_init = mdc_thread_init,
+        .lct_fini = mdc_thread_fini
+};
+
+int mdc_type_init(struct lu_device_type *ldt)
+{
+        return lu_context_key_register(&mdc_thread_key);
+}
+
+void mdc_type_fini(struct lu_device_type *ldt)
+{
+        lu_context_key_deregister(&mdc_thread_key);
+}
+
+static struct lu_device_type_operations mdc_device_type_ops = {
+        .ldto_init = mdc_type_init,
+        .ldto_fini = mdc_type_fini,
+
+        .ldto_device_alloc = mdc_device_alloc,
+        .ldto_device_free  = mdc_device_free,
+
+        .ldto_device_init = mdc_device_init,
+        .ldto_device_fini = mdc_device_fini
+};
+
+struct lu_device_type mdc_device_type = {
+        .ldt_tags = LU_DEVICE_MD,
+        .ldt_name = LUSTRE_MDC0_NAME,
+        .ldt_ops  = &mdc_device_type_ops
+};
+#else
 static int mdc_root_get(const struct lu_context *ctx, struct md_device *md,
                         struct lu_fid *fid)
 {
@@ -149,150 +343,7 @@ static struct lu_device_operations mdc_lu_ops = {
 
         .ldo_process_config = mdc_process_config
 };
-#if 0
-static int mdc_device_connect(struct mdc_device *mc)
-{
-        struct mdc_cli_desc *desc = &mc->mc_desc;
-        struct obd_device *obd = mdc2lu_dev(mc)->ld_obd;
-        //struct client_obd *cli = &obd->u.cli;
-        struct obd_uuid mdc_uuid = { "MDT_MDC_UUID" };
-        struct lustre_handle conn = { 0 };
-        struct obd_import *imp = desc->cl_import;
-        int rc;
-
-        /* obd_connect */
-        rc = class_connect(&conn, obd, &mdc_uuid);
-        imp->imp_dlm_handle = conn;
-
-        rc = ptlrpc_init_import(imp);
-        if (rc != 0)
-                RETURN(rc);
-
-        rc = ptlrpc_connect_import(imp, NULL);
-        if (rc != 0) {
-                LASSERT (imp->imp_state == LUSTRE_IMP_DISCON);
-                RETURN(rc);
-        }
-
-        ptlrpc_pinger_add_import(imp);
-        //TODO other initializations
-        LASSERT(imp->imp_connection);
-
-        RETURN(0);
-}
-
-static int mdc_device_init(const struct lu_context *ctx,
-                           struct lu_device *ld, struct lu_device *next)
-{
-        struct mdc_device *mc = lu2mdc_dev(ld);
-        struct mdc_cli_desc *desc = &mc->mc_desc;
-        struct obd_device *obd = ld->ld_obd;
-        struct client_obd *cli = &obd->u.cli;
-        struct obd_import *imp;
-        int rq_portal, rp_portal, connect_op;
-        int rc = 0;
-
-        ENTRY;
-        //alloc rpc_lock
-        ptlrpcd_addref();
-
-        rq_portal = MDS_REQUEST_PORTAL;
-        rp_portal = MDC_REPLY_PORTAL;
-        connect_op = MDS_CONNECT;
-
-        sema_init(&cli->cl_sem, 1);
-        cli->cl_conn_count = 0;
-
-        rc = ldlm_get_ref();
-        if (rc != 0) {
-                CERROR("ldlm_get_ref failed: %d\n", rc);
-                GOTO(err, rc);
-        }
-
-        ptlrpc_init_client(rq_portal, rp_portal, obd->obd_type->typ_name,
-                           &desc->cl_ldlm_client);
-
-        imp = class_new_import(obd);
-        if (imp == NULL)
-                GOTO(err_ldlm, rc = -ENOENT);
-
-        imp->imp_client = &desc->cl_ldlm_client;
-        imp->imp_connect_op = connect_op;
-        imp->imp_initial_recov = 1;
-        imp->imp_initial_recov_bk = 0;
-        INIT_LIST_HEAD(&imp->imp_pinger_chain);
-        cli->cl_target_uuid = desc->cl_target_uuid;
-        class_import_put(imp);
-        rc = client_import_add_conn(imp, &desc->cl_server_uuid, 1);
-        if (rc) {
-                CERROR("can't add initial connection\n");
-                GOTO(err_import, rc);
-        }
-
-        desc->cl_import = imp;
-        cli->cl_import = imp;
-
-        rc = mdc_device_connect(mc);
-
-        RETURN(0);
-
-err_import:
-        class_destroy_import(imp);
-err_ldlm:
-        ldlm_put_ref(0);
-err:
-        //free rpc_lock
-        ptlrpcd_decref();
-        RETURN(rc);
-}
-
-static struct lu_device *mdc_device_fini(const struct lu_context *ctx,
-                                         struct lu_device *ld)
-{
-       struct mdc_device *mc = lu2mdc_dev(ld);
-        struct mdc_cli_desc *desc = &mc->mc_desc;
-
-        ENTRY;
-
-        class_destroy_import(desc->cl_import);
-        //TODO: force param
-        ldlm_put_ref(1);
-        ptlrpcd_decref();
-
-        RETURN (NULL);
-}
-
-struct lu_device *mdc_device_alloc(const struct lu_context *ctx,
-                                   struct lu_device_type *ldt,
-                                   struct lustre_cfg *cfg)
-{
-        struct lu_device  *ld;
-        struct mdc_device *mc;
-
-        ENTRY;
-
-        OBD_ALLOC_PTR(mc);
-        if (mc == NULL) {
-                ld = ERR_PTR(-ENOMEM);
-        } else {
-                md_device_init(&mc->mc_md_dev, ldt);
-                mc->mc_md_dev.md_ops = &mdc_md_ops;
-               ld = mdc2lu_dev(mc);
-                ld->ld_ops = &mdc_lu_ops;
-                memcpy(mc->mc_desc.cl_server_uuid.uuid,
-                       lustre_cfg_buf(cfg, 2),
-                       min_t(unsigned int, LUSTRE_CFG_BUFLEN(cfg, 2),
-                             sizeof(struct obd_uuid)));
-                memcpy(mc->mc_desc.cl_target_uuid.uuid,
-                       lustre_cfg_buf(cfg, 1),
-                       min_t(unsigned int, LUSTRE_CFG_BUFLEN(cfg, 1),
-                             sizeof(struct obd_uuid)));
 
-        }
-
-        RETURN (ld);
-}
-#endif
 static int mdc_device_init(const struct lu_context *ctx,
                            struct lu_device *ld, struct lu_device *next)
 {
@@ -370,41 +421,4 @@ struct lu_device_type mdc_device_type = {
         .ldt_name = LUSTRE_MDC0_NAME,
         .ldt_ops  = &mdc_device_type_ops
 };
-#if 0
-static struct obd_ops mdc0_obd_device_ops = {
-        .o_owner           = THIS_MODULE
-};
-
-struct lprocfs_vars lprocfs_mdc0_obd_vars[] = {
-        { 0 }
-};
-
-struct lprocfs_vars lprocfs_mdc0_module_vars[] = {
-        { 0 }
-};
-
-LPROCFS_INIT_VARS(mdc0, lprocfs_mdc0_module_vars, lprocfs_mdc0_obd_vars);
-
-static int __init mdc0_mod_init(void)
-{
-        struct lprocfs_static_vars lvars;
-
-        printk(KERN_INFO "Lustre: Metadata Client; info@clusterfs.com\n");
-
-        lprocfs_init_vars(mdc0, &lvars);
-        return class_register_type(&mdc0_obd_device_ops, NULL,
-                                   lvars.module_vars, LUSTRE_MDC0_NAME,
-                                   &mdc_device_type);
-}
-
-static void __exit mdc0_mod_exit(void)
-{
-        class_unregister_type(LUSTRE_MDC0_NAME);
-}
-
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Metadata Client Prototype ("LUSTRE_MDC0_NAME")");
-MODULE_LICENSE("GPL");
-
-cfs_module(mdc, "0.0.1", mdc0_mod_init, mdc0_mod_exit);
-#endif
+#endif /* CMM_CODE */
index 6a2d3df..1f66261 100644 (file)
 
 #if defined(__KERNEL__)
 
+#include <lustre_net.h>
 #include <obd.h>
 #include <md_object.h>
 
 struct mdc_cli_desc {
         struct obd_connect_data  cl_conn_data;
         struct obd_uuid          cl_srv_uuid;
-        struct obd_uuid          cl_cli_uuid;
         struct obd_export        *cl_exp;
 };
 
@@ -43,6 +43,14 @@ struct mdc_device {
         struct mdc_cli_desc     mc_desc;
 };
 
+#ifdef CMM_CODE
+struct mdc_thread_info {
+        const struct lu_context *mci_ctxt;
+        struct md_op_data       mci_opdata;
+        struct ptlrpc_request   *mci_req;
+};
+#endif
+
 struct mdc_object {
        struct md_object        mco_obj;
 };
index 6543256..ce955f7 100644 (file)
 #endif
 
 #define DEBUG_SUBSYSTEM S_MDS
-#include <lustre/lustre_idl.h>
 #include <obd_support.h>
 #include <lustre_lib.h>
-#include <lustre_net.h>
 #include <obd_class.h>
 #include "mdc_internal.h"
 
@@ -42,6 +40,192 @@ static struct md_object_operations mdc_mo_ops;
 static struct md_dir_operations mdc_dir_ops;
 static struct lu_object_operations mdc_obj_ops;
 
+#ifdef CMM_CODE
+extern struct lu_context_key mdc_thread_key;
+
+struct lu_object *mdc_object_alloc(const struct lu_context *ctx,
+                                   const struct lu_object_header *hdr,
+                                   struct lu_device *ld)
+{
+       struct mdc_object *mco;
+        ENTRY;
+
+       OBD_ALLOC_PTR(mco);
+       if (mco != NULL) {
+               struct lu_object *lo;
+
+               lo = &mco->mco_obj.mo_lu;
+                lu_object_init(lo, NULL, ld);
+                mco->mco_obj.mo_ops = &mdc_mo_ops;
+                mco->mco_obj.mo_dir_ops = &mdc_dir_ops;
+                lo->lo_ops = &mdc_obj_ops;
+                RETURN(lo);
+       } else
+               RETURN(NULL);
+}
+
+static void mdc_object_free(const struct lu_context *ctx, struct lu_object *lo)
+{
+        struct mdc_object *mco = lu2mdc_obj(lo);
+       lu_object_fini(lo);
+        OBD_FREE_PTR(mco);
+}
+
+static int mdc_object_init(const struct lu_context *ctx, struct lu_object *lo)
+{
+        ENTRY;
+
+        RETURN(0);
+}
+
+static void mdc_object_release(const struct lu_context *ctx,
+                               struct lu_object *lo)
+{
+}
+
+static int mdc_object_exists(const struct lu_context *ctx, struct lu_object *lo)
+{
+        /* we don't know does it exists or not - but suppose that it does*/
+        return 1;
+}
+
+static int mdc_object_print(const struct lu_context *ctx,
+                            struct seq_file *f, const struct lu_object *lo)
+{
+       return seq_printf(f, LUSTRE_MDC0_NAME"-object@%p", lo);
+}
+
+static struct lu_object_operations mdc_obj_ops = {
+        .loo_object_init    = mdc_object_init,
+       .loo_object_release = mdc_object_release,
+        .loo_object_free    = mdc_object_free,
+       .loo_object_print   = mdc_object_print,
+       .loo_object_exists  = mdc_object_exists
+};
+
+/* md_object_operations */
+static int mdc_object_create(const struct lu_context *ctx,
+                             struct md_object *mo, struct lu_attr *attr)
+{
+        struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+        struct mdc_thread_info *mci;
+        int rc;
+        ENTRY;
+
+        mci = lu_context_get_key(ctx, &mdc_thread_key);
+        LASSERT(mci);
+
+        mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
+        mci->mci_opdata.fid2 = { 0 };
+        mci->mci_opdata.mod_time = attr->la_mtime;
+        mci->mci_opdata.name = NULL;
+        mci->mci_opdata.namelen = 0;
+
+        rc = md_create(mc->mc_desc.cl_exp, &mci->mci_opdata, NULL, 0,
+                       attr->la_mode, attr->la_uid, attr->la_gid, 0, 0,
+                       &mci->mci_req);
+
+        RETURN(rc);
+}
+static int mdc_ref_add(const struct lu_context *ctx, struct md_object *mo)
+{
+        struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+        struct mdc_thread_info *mci;
+        int rc;
+        ENTRY;
+
+        mci = lu_context_get_key(ctx, &mdc_thread_key);
+        LASSERT(mci);
+
+        mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
+        mci->mci_opdata.fid2 = { 0 };
+        mci->mci_opdata.mod_time = attr->la_mtime;
+        mci->mci_opdata.name = NULL;
+        mci->mci_opdata.namelen = 0;
+
+        rc = md_link(mc->mc_desc.cl_exp, &mci->mci_opdata, &mci->mci_req);
+
+        RETURN(rc);
+}
+
+static int mdc_ref_del(const struct lu_context *ctx, struct md_object *mo)
+{
+        struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+        struct mdc_thread_info *mci;
+        int rc;
+        ENTRY;
+
+        mci = lu_context_get_key(ctx, &mdc_thread_key);
+        LASSERT(mci);
+
+        mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
+        mci->mci_opdata.fid2 = { 0 };
+        mci->mci_opdata.mod_time = attr->la_mtime;
+        mci->mci_opdata.name = NULL;
+        mci->mci_opdata.namelen = 0;
+
+        rc = md_unlink(mc->mc_desc.cl_exp, &mci->mci_opdata, &mci->mci_req);
+
+        RETURN(rc);
+}
+
+static struct md_object_operations mdc_mo_ops = {
+        .moo_object_create  = mdc_object_create,
+        .moo_ref_add        = mdc_ref_add,
+        .moo_ref_del        = mdc_ref_del,
+};
+
+/* md_dir_operations */
+static int mdc_name_insert(const struct lu_context *ctx, struct md_object *mo,
+                           const char *name, const struct lu_fid *lf)
+{
+        struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+        struct mdc_thread_info *mci;
+        int rc;
+        ENTRY;
+
+        mci = lu_context_get_key(ctx, &mdc_thread_key);
+        LASSERT(mci);
+
+        mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
+        mci->mci_opdata.fid2 = *lf;
+        mci->mci_opdata.mod_time = attr->la_mtime;
+        //TODO: distinguish the name_insert and rename_tgt()
+
+        rc = md_rename(mc->mc_desc.cl_exp, &mci->mci_opdata, NULL, 0,
+                       name, strlen(name), &mci->mci_req);
+
+        RETURN(rc);
+}
+
+static int mdc_rename_tgt(const struct lu_context *ctx,
+                          struct md_object *mo_p, struct md_object *mo_s,
+                          struct md_object *mo_t, const char *name)
+{
+        struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+        struct mdc_thread_info *mci;
+        int rc;
+        ENTRY;
+
+        mci = lu_context_get_key(ctx, &mdc_thread_key);
+        LASSERT(mci);
+
+        mci->mci_opdata.fid1 = *lu_object_fid(&mo_p->mo_lu);
+        mci->mci_opdata.fid2 = *lu_object_fid(&mo_s->mo_lu);
+        mci->mci_opdata.mod_time = attr->la_mtime;
+
+        rc = md_rename(mc->mc_desc.cl_exp, &mci->mci_opdata, NULL, 0,
+                       name, strlen(name), &mci->mci_req);
+
+        RETURN(rc);
+}
+
+static struct md_dir_operations mdc_dir_ops = {
+        .mdo_name_insert = mdc_name_insert,
+        .mdo_rename_tgt  = mdc_rename_tgt,
+};
+
+#else /* CMM_CODE */
 struct lu_object *mdc_object_alloc(const struct lu_context *ctx,
                                    const struct lu_object_header *hdr,
                                    struct lu_device *ld)
@@ -113,46 +297,6 @@ static int mdc_object_create(const struct lu_context *ctx,
         };
         int rc;
 
-
-#if 0
-        req = ptlrpc_prep_req(mc->mc_desc.cl_import, LUSTRE_MDS_VERSION,
-                              MDS_REINT, 1, &size, NULL);
-        if (req == NULL)
-                RETURN(-ENOMEM);
-/*
-        mdc_create_pack(req, MDS_REQ_REC_OFF, op_data, data, datalen, mode,
-                        uid, gid, cap_effective, rdev);
-*/
-        rec = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*rec));
-        rec->cr_opcode = REINT_CREATE;
-        rec->cr_fsuid = attr->la_uid;
-        rec->cr_fsgid = attr->la_gid;
-        rec->cr_cap = 0;//cap_effective;
-        rec->cr_fid1 = *lu_object_fid(&mo->mo_lu);
-        memset(&rec->cr_fid2, 0, sizeof(rec->cr_fid2));
-        rec->cr_mode = attr->la_mode;
-        rec->cr_rdev = 0;//rdev;
-        rec->cr_time = attr->la_mtime; //op_data->mod_time;
-        rec->cr_suppgid = 0;//op_data->suppgids[0];
-
-
-        size = sizeof(struct mdt_body);
-        req->rq_replen = lustre_msg_size(1, &size);
-
-        level = LUSTRE_IMP_FULL;
-        req->rq_send_state = level;
-        //mdc_get_rpc_lock(rpc_lock, NULL);
-        rc = ptlrpc_queue_wait(req);
-        //mdc_put_rpc_lock(rpc_lock, NULL);
-        if (rc)
-                CDEBUG(D_INFO, "error in handling %d\n", rc);
-        else if (!lustre_swab_repbuf(req, 0, sizeof(struct mdt_body),
-                                     lustre_swab_mdt_body)) {
-                CERROR ("Can't unpack mdt_body\n");
-                rc = -EPROTO;
-        } else
-                CDEBUG(D_INFO, "Done MDC req!\n");
-#endif
         rc = md_create(exp, &op_data, NULL, 0, attr->la_mode, attr->la_uid,
                        attr->la_gid, 0, 0, &req);
         RETURN(rc);
@@ -172,4 +316,4 @@ static struct lu_object_operations mdc_obj_ops = {
        .loo_object_print   = mdc_object_print,
        .loo_object_exists  = mdc_object_exists
 };
-
+#endif /* CMM_CODE */