Whamcloud - gitweb
b=3031
[fs/lustre-release.git] / lustre / cobd / cache_obd.c
index fdebff1..bb3bbcf 100644 (file)
 #include <linux/lustre_mds.h>
 #include <linux/obd_class.h>
 #include <linux/obd_cache.h>
+#include <linux/obd_lmv.h>
 
-static int cobd_attach(struct obd_device *obd, obd_count len, void *buf)
+static int cobd_attach(struct obd_device *obd,
+                       obd_count len, void *buf)
 {
         struct lprocfs_static_vars lvars;
         
@@ -45,155 +47,194 @@ static int cobd_detach(struct obd_device *obd)
         return lprocfs_obd_detach(obd);
 }
 
-static int connect_to_obd(char *name, struct lustre_handle *conn)
-{ 
-        struct obd_uuid   obd_uuid;
-        struct obd_device *obd;
-        int    rc = 0;
-        ENTRY;
-        obd = class_name2obd(name);
-        if (obd == NULL) {
-                CERROR("%s: unable to find a client for obd: %s\n",
-                       obd->obd_name, name);
-                RETURN(-EINVAL);
-        }
-        rc = obd_connect(conn, obd, &obd_uuid);
-        RETURN(rc);
-}
-
 static int cobd_setup(struct obd_device *obd, obd_count len, void *buf)
 {
         struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
         struct cache_obd  *cobd = &obd->u.cobd;
-        struct lustre_handle real_conn = {0,}, cache_conn = {0,};
-        struct obd_device *real;
-        struct obd_device *cache;
-        int rc;
+        struct obd_device *master;
+        int rc = 0;
         ENTRY;
 
         if (lcfg->lcfg_inllen1 == 0 || lcfg->lcfg_inlbuf1 == NULL) {
-                CERROR("%s: setup requires real device name\n", 
+                CERROR("%s: setup requires master device name\n", 
                        obd->obd_name);
                 RETURN(-EINVAL);
         }
 
-        real = class_name2obd(lcfg->lcfg_inlbuf1);
-        if (real == NULL) {
-                CERROR("%s: unable to find a client for real: %s\n",
-                       obd->obd_name, lcfg->lcfg_inlbuf1);
-                RETURN(-EINVAL);
-        }
-
         if (lcfg->lcfg_inllen2 == 0 || lcfg->lcfg_inlbuf2 == NULL) {
-                CERROR("%s: setup requires cache device name\n", obd->obd_name);
+                CERROR("%s: setup requires cache device name\n",
+                       obd->obd_name);
                 RETURN(-EINVAL);
         }
 
-        cache  = class_name2obd(lcfg->lcfg_inlbuf2);
-        if (cache == NULL) {
-                CERROR("%s: unable to find a client for cache: %s\n",
-                       obd->obd_name, lcfg->lcfg_inlbuf2);
+        master = class_name2obd(lcfg->lcfg_inlbuf1);
+        if (!master) {
+                CERROR("%s: unable to find master: %s\n",
+                       obd->obd_name, lcfg->lcfg_inlbuf1);
                 RETURN(-EINVAL);
         }
 
-        OBD_ALLOC(cobd->cobd_real_name, strlen(lcfg->lcfg_inlbuf1) + 1);
-        if (!cobd->cobd_real_name) 
-                GOTO(exit, rc = -ENOMEM);
-        memcpy(cobd->cobd_real_name, lcfg->lcfg_inlbuf1, 
-               strlen(lcfg->lcfg_inlbuf1));
-        
-        OBD_ALLOC(cobd->cobd_cache_name, strlen(lcfg->lcfg_inlbuf2) + 1);
-        if (!cobd->cobd_cache_name) 
-                GOTO(exit, rc = -ENOMEM);
-        memcpy(cobd->cobd_cache_name, lcfg->lcfg_inlbuf2, 
-               strlen(lcfg->lcfg_inlbuf2));
-
-        /* don't bother checking attached/setup;
-         * obd_connect() should, and it can change underneath us */
-        rc = connect_to_obd(cobd->cobd_real_name, &real_conn);
-        if (rc != 0)
-                GOTO(exit, rc);
-        cobd->cobd_real_exp = class_conn2export(&real_conn);
-        
-        rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
-        if (rc != 0) {
-                obd_disconnect(cobd->cobd_cache_exp, 0);
-                GOTO(exit, rc);
-        }
-        cobd->cobd_cache_exp = class_conn2export(&cache_conn);
+        sema_init(&cobd->sem, 1);
+
+        OBD_ALLOC(cobd->master_name, lcfg->lcfg_inllen1);
+        if (!cobd->master_name) 
+                RETURN(-ENOMEM);
+        memcpy(cobd->master_name, lcfg->lcfg_inlbuf1, 
+               lcfg->lcfg_inllen1);
         
-        if (!strcmp(real->obd_type->typ_name, LUSTRE_MDC_NAME)) {
-                /* set mds_num for lustre */
-                int mds_num;
-                mds_num = REAL_MDS_NUMBER;
-                obd_set_info(cobd->cobd_real_exp, strlen("mds_num"),
-                             "mds_num", sizeof(mds_num), &mds_num);
-                mds_num = CACHE_MDS_NUMBER;
-                obd_set_info(cobd->cobd_cache_exp, strlen("mds_num"),
-                             "mds_num", sizeof(mds_num), &mds_num);
-        }
-        /*default write to real obd*/
-exit:
+        OBD_ALLOC(cobd->cache_name, lcfg->lcfg_inllen2);
+        if (!cobd->cache_name) 
+                GOTO(put_names, rc = -ENOMEM);
+        memcpy(cobd->cache_name, lcfg->lcfg_inlbuf2, 
+               lcfg->lcfg_inllen2);
+
+        EXIT;
+put_names:
         if (rc) {
-                if (cobd->cobd_cache_name)
-                        OBD_FREE(cobd->cobd_cache_name, 
-                                 strlen(cobd->cobd_cache_name) + 1);
-                if (cobd->cobd_real_name)
-                        OBD_FREE(cobd->cobd_real_name, 
-                                 strlen(cobd->cobd_real_name) + 1);
+                OBD_FREE(cobd->master_name, lcfg->lcfg_inllen1);
+                cobd->master_name = NULL;
         }
-        cobd->cache_on = 1;
-        RETURN(rc);
+        return rc;
 }
 
 static int cobd_cleanup(struct obd_device *obd, int flags)
 {
         struct cache_obd  *cobd = &obd->u.cobd;
-        int                rc;
+        ENTRY;
 
         if (!list_empty(&obd->obd_exports))
-                return (-EBUSY);
+                RETURN(-EBUSY);
+
+        if (cobd->cache_name)
+                OBD_FREE(cobd->cache_name, 
+                         strlen(cobd->cache_name) + 1);
+        if (cobd->master_name)
+                OBD_FREE(cobd->master_name, 
+                         strlen(cobd->master_name) + 1);
         
-        OBD_FREE(cobd->cobd_cache_name, strlen(cobd->cobd_cache_name) + 1);
-        OBD_FREE(cobd->cobd_real_name, strlen(cobd->cobd_real_name) + 1);
+        RETURN(0);
+}
+
+static inline struct obd_export *
+cobd_get_exp(struct obd_device *obd)
+{
+        struct cache_obd *cobd = &obd->u.cobd;
+        if (cobd->cache_on)  
+                return cobd->cache_exp;
+        return cobd->master_exp;
+}
+
+static int client_obd_connect(struct obd_device *obd, char *name,
+                              struct lustre_handle *conn,
+                              struct obd_connect_data *data,
+                              unsigned long flags)
+{ 
+        struct obd_device *cli_obd;
+        int rc = 0;
+        ENTRY;
+        LASSERT(obd);
+        LASSERT(name);
+        LASSERT(conn);
         
-        if (cobd->cache_on) { 
-                rc = obd_disconnect(cobd->cobd_cache_exp, flags);
-                if (rc != 0)
-                        CERROR("error %d disconnecting cache\n", rc);
+        cli_obd = class_name2obd(name);
+        if (cli_obd == NULL) {
+                CERROR("%s: unable to find a client for obd: %s\n",
+                       obd->obd_name, name);
+                RETURN(-EINVAL);
         }
-        rc = obd_disconnect(cobd->cobd_real_exp, flags);
-        if (rc != 0)
-                CERROR("error %d disconnecting real\n", rc);
-        
-        return (rc);
+        rc = obd_connect(conn, cli_obd, &obd->obd_uuid, data, flags);
+        if (rc) {
+                CERROR("error connecting to %s, err %d\n",
+                       name, rc);
+        }
+        RETURN(rc);
 }
 
-struct obd_export *cobd_get_exp(struct obd_device *obd)
+static int client_obd_disconnect(struct obd_device *obd,
+                                 struct obd_export *exp,
+                                 unsigned long flags)
 {
-        struct cache_obd  *cobd = &obd->u.cobd;
+        struct obd_device *cli_obd;
+        int rc = 0;
+        ENTRY;
+
+        cli_obd = class_exp2obd(exp);
+        cli_obd->obd_no_recov = obd->obd_no_recov;
         
-        if (cobd->cache_on)  
-                return cobd->cobd_cache_exp;
-        else
-                return cobd->cobd_real_exp;
+        rc = obd_disconnect(exp, flags);
+        if (rc) {
+                CERROR("error disconnecting from %s, err %d\n",
+                       cli_obd->obd_name, rc);
+                class_export_put(exp);
+        }
+        RETURN(rc);
 }
 
 static int
 cobd_connect(struct lustre_handle *conn, struct obd_device *obd,
-             struct obd_uuid *cluuid)
+             struct obd_uuid *cluuid, struct obd_connect_data *data,
+             unsigned long flags)
 {
-        int rc;
+        struct lustre_handle cache_conn = { 0 };
+        struct cache_obd *cobd = &obd->u.cobd;
+        struct obd_export *exp;
+        int rc = 0;
+        ENTRY;
+
+        /* connecting class */
         rc = class_connect(conn, obd, cluuid);
-        return rc; 
+        if (rc)
+                RETURN(rc);
+        exp = class_conn2export(conn);
+
+        /* connecting cache */
+        rc = client_obd_connect(obd, cobd->cache_name,
+                                &cache_conn, data, flags);
+        if (rc)
+                GOTO(err_discon, rc);
+        cobd->cache_exp = class_conn2export(&cache_conn);
+        cobd->cache_on = 1;
+
+        EXIT;
+err_discon:
+        if (rc)
+                class_disconnect(exp, 0);
+        else
+                class_export_put(exp);
+        return rc;
 }
 
-static int cobd_disconnect(struct obd_export *exp, int flags)
+static int
+cobd_disconnect(struct obd_export *exp, unsigned long flags)
 {
-        int rc;
-        rc = class_disconnect(exp, 0);
-        return rc; 
+        struct obd_device *obd;
+        struct cache_obd *cobd;
+        int rc = 0;
+        ENTRY;
+        
+        LASSERT(exp != NULL);
+        obd = class_exp2obd(exp);
+        if (obd == NULL) {
+                CDEBUG(D_IOCTL, "invalid client cookie "LPX64"\n",
+                       exp->exp_handle.h_cookie);
+                RETURN(-EINVAL);
+        }
+
+        cobd = &obd->u.cobd;
+        
+        if (cobd->cache_on) {
+                rc = client_obd_disconnect(obd, cobd->cache_exp,
+                                           flags);
+                cobd->cache_exp = NULL;
+        } else {
+                rc = client_obd_disconnect(obd, cobd->master_exp,
+                                           flags);
+                cobd->master_exp = NULL;
+        }
+
+        rc = class_disconnect(exp, flags);
+        RETURN(rc);
 }
 
 static int cobd_get_info(struct obd_export *exp, obd_count keylen,
@@ -201,14 +242,15 @@ static int cobd_get_info(struct obd_export *exp, obd_count keylen,
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
+        
         if (obd == NULL) {
                 CERROR("invalid client cookie "LPX64"\n", 
                        exp->exp_handle.h_cookie);
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        /* intercept cache utilisation info? */
 
+        /* intercept cache utilisation info? */
         return obd_get_info(cobd_exp, keylen, key, vallen, val);
 }
 
@@ -224,8 +266,8 @@ static int cobd_set_info(struct obd_export *exp, obd_count keylen,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
+        
         /* intercept cache utilisation info? */
-
         return obd_set_info(cobd_exp, keylen, key, vallen, val);
 }
 
@@ -306,12 +348,12 @@ static int cobd_destroy(struct obd_export *exp, struct obdo *obdo,
 
 static int cobd_precleanup(struct obd_device *obd, int flags)
 {
-        /*FIXME Do we need some cleanup here?*/
+        /* FIXME-WANGDI: do we need some cleanup here? */
         return 0;
 }
 
 static int cobd_getattr(struct obd_export *exp, struct obdo *oa,
-                        struct lov_stripe_md *lsm)
+                        struct lov_stripe_md *ea)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -322,12 +364,12 @@ static int cobd_getattr(struct obd_export *exp, struct obdo *oa,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return obd_getattr(cobd_exp, oa, lsm);
+        return obd_getattr(cobd_exp, oa, ea);
 }
 
 static int cobd_getattr_async(struct obd_export *exp,
-                             struct obdo *obdo, struct lov_stripe_md *ea,
-                             struct ptlrpc_request_set *set)
+                              struct obdo *obdo, struct lov_stripe_md *ea,
+                              struct ptlrpc_request_set *set)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -357,7 +399,8 @@ static int cobd_setattr(struct obd_export *exp, struct obdo *obdo,
         return obd_setattr(cobd_exp, obdo, ea, oti);
 }
 
-static int cobd_md_getstatus(struct obd_export *exp, struct ll_fid *rootfid)
+static int cobd_md_getstatus(struct obd_export *exp,
+                             struct lustre_id *rootid)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -368,7 +411,7 @@ static int cobd_md_getstatus(struct obd_export *exp, struct ll_fid *rootfid)
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getstatus(cobd_exp, rootfid);
+        return md_getstatus(cobd_exp, rootid);
 }
 
 static int cobd_brw(int cmd, struct obd_export *exp, struct obdo *oa,
@@ -430,7 +473,7 @@ static int cobd_queue_async_io(struct obd_export *exp,
                                struct lov_stripe_md *lsm,
                                struct lov_oinfo *loi, void *cookie,
                                int cmd, obd_off off, int count,
-                               obd_flag brw_flags, obd_flag async_flags)
+                               obd_flags brw_flags, obd_flags async_flags)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -448,7 +491,7 @@ static int cobd_queue_async_io(struct obd_export *exp,
 static int cobd_set_async_flags(struct obd_export *exp,
                                struct lov_stripe_md *lsm,
                                struct lov_oinfo *loi, void *cookie,
-                               obd_flag async_flags)
+                               obd_flags async_flags)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -467,8 +510,8 @@ static int cobd_queue_group_io(struct obd_export *exp,
                                struct lov_oinfo *loi, 
                                struct obd_io_group *oig, 
                                void *cookie, int cmd, obd_off off, 
-                               int count, obd_flag brw_flags,
-                               obd_flag async_flags)
+                               int count, obd_flags brw_flags,
+                               obd_flags async_flags)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -670,62 +713,74 @@ static int cobd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
 
 static int cobd_flush(struct obd_device *obd)
 {
-       /*FLUSH the filesystem from the cache 
-        *to the real device */
         return 0; 
 }
 
-static int cobd_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
-                          void *karg, void *uarg)
+static int cobd_iocontrol(unsigned int cmd, struct obd_export *exp,
+                          int len, void *karg, void *uarg)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct cache_obd  *cobd = &obd->u.cobd;
-        struct obd_device *real_dev = class_exp2obd(cobd->cobd_real_exp);
-        struct obd_device *cache_dev = class_exp2obd(cobd->cobd_cache_exp); 
         struct obd_export *cobd_exp;
         int rc = 0;
+        ENTRY;
+
+        down(&cobd->sem);
+        
         switch (cmd) {
         case OBD_IOC_COBD_CON:
                 if (!cobd->cache_on) {
-                        struct lustre_handle cache_conn = {0,};
-                        
-                        rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
-                        if (rc != 0)
-                                RETURN(rc); 
-                        cobd->cobd_cache_exp = class_conn2export(&cache_conn);
+                        struct lustre_handle conn = {0};
+
+                        rc = client_obd_disconnect(obd, cobd->master_exp, 0);
+                        rc = client_obd_connect(obd, cobd->cache_name, &conn,
+                                                NULL, 0);
+                        if (rc)
+                                GOTO(out, rc);
+                        cobd->cache_exp = class_conn2export(&conn);
                         cobd->cache_on = 1;
                 }
                 break;
         case OBD_IOC_COBD_COFF: 
                 if (cobd->cache_on) {
-                        /*Here disconnect for cancel unused ldlm resources,
-                         *then do flush, otherwise, there will be some problems
-                         *in flush cache
-                         *is is right? FIXME later*/
-                        rc = obd_disconnect(cobd->cobd_cache_exp, 0);
-                        if (rc != 0)
-                                CERROR("error %d disconnecting real\n", rc);
-
+                        struct lustre_handle conn = {0,};
+                        struct obd_device *master = NULL;
+                        struct obd_device *cache = NULL;
+                        int easize, cooksize;
+
+                        cache = class_exp2obd(cobd->cache_exp); 
+                        easize = cache->u.cli.cl_max_mds_easize; 
+                        cooksize = cache->u.cli.cl_max_mds_cookiesize;
+                        
+                        rc = client_obd_disconnect(obd, cobd->cache_exp, 0);
+                        rc = client_obd_connect(obd, cobd->master_name, &conn,
+                                                NULL, 0);
+                        if (rc)
+                                GOTO(out, rc);
+                        cobd->master_exp = class_conn2export(&conn);
+
+                        master = class_exp2obd(cobd->master_exp);
+                        master->u.cli.cl_max_mds_easize = easize;
+                        master->u.cli.cl_max_mds_cookiesize = cooksize;
                         cobd->cache_on = 0;
-                        /*FIXME, should read from real_dev*/
-                       real_dev->u.cli.cl_max_mds_easize =
-                                              cache_dev->u.cli.cl_max_mds_easize;
-                       real_dev->u.cli.cl_max_mds_cookiesize =
-                                              cache_dev->u.cli.cl_max_mds_cookiesize;
                 }
                 break;
         case OBD_IOC_COBD_CFLUSH:
                 if (cobd->cache_on) {
                         cobd->cache_on = 0;
                         cobd_flush(obd);
+                } else {
+                        CERROR("%s: cache is turned off\n", obd->obd_name);
                 }
                 break;
         default:
                 cobd_exp = cobd_get_exp(obd);
                 rc = obd_iocontrol(cmd, cobd_exp, len, karg, uarg);
         }
-        
+
+        EXIT;
+out:
+        up(&cobd->sem);
         return rc;
 }
 
@@ -755,15 +810,14 @@ static int cobd_llog_finish(struct obd_device *obd, struct obd_llogs *llogs,
         return obd_llog_finish(cobd_obd, &cobd_obd->obd_llogs, count);
 }
 
-static int cobd_notify(struct obd_device *obd,
-                       struct obd_device *watched,
-                       int active)
+static int cobd_notify(struct obd_device *obd, struct obd_device *watched,
+                       int active, void *data)
 {
         struct obd_export *cobd_exp;
 
         cobd_exp = cobd_get_exp(obd);
 
-        return obd_notify(class_exp2obd(cobd_exp), watched, active);
+        return obd_notify(class_exp2obd(cobd_exp), watched, active, data);
 }
 
 static int cobd_pin(struct obd_export *exp, obd_id ino, __u32 gen,
@@ -819,9 +873,9 @@ static int  cobd_import_event(struct obd_device *obd,
         return 0; 
 }
 
-static int cobd_md_getattr(struct obd_export *exp, struct ll_fid *fid,
-                           unsigned long valid, unsigned int ea_size,
-                           struct ptlrpc_request **request)
+static int cobd_md_getattr(struct obd_export *exp, struct lustre_id *id,
+                          __u64 valid, const char *ea_name, int ea_namelen,
+                           unsigned int ea_size, struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -832,7 +886,7 @@ static int cobd_md_getattr(struct obd_export *exp, struct ll_fid *fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getattr(cobd_exp, fid, valid, ea_size, request);
+        return md_getattr(cobd_exp, id, valid, NULL, 0, ea_size, request);
 }
 
 static int cobd_md_req2lustre_md (struct obd_export *mdc_exp, 
@@ -851,7 +905,7 @@ static int cobd_md_req2lustre_md (struct obd_export *mdc_exp,
         return md_req2lustre_md(cobd_exp, req, offset, osc_exp, md);
 }
 
-static int cobd_md_change_cbdata(struct obd_export *exp, struct ll_fid *fid, 
+static int cobd_md_change_cbdata(struct obd_export *exp, struct lustre_id *id, 
                                  ldlm_iterator_t it, void *data)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -863,14 +917,12 @@ static int cobd_md_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_change_cbdata(cobd_exp, fid, it, data);
+        return md_change_cbdata(cobd_exp, id, it, data);
 }
 
-static int cobd_md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
-                                char *filename, int namelen, 
-                                unsigned long valid,
-                                unsigned int ea_size, 
-                                struct ptlrpc_request **request)
+static int cobd_md_getattr_lock(struct obd_export *exp, struct lustre_id *id,
+                                char *filename, int namelen, __u64 valid,
+                                unsigned int ea_size, struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -881,7 +933,7 @@ static int cobd_md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getattr_name(cobd_exp, fid, filename, namelen, valid,
+        return md_getattr_lock(cobd_exp, id, filename, namelen, valid,
                                ea_size, request);
 }
 
@@ -918,7 +970,8 @@ static int cobd_md_unlink(struct obd_export *exp, struct mdc_op_data *data,
         return md_unlink(cobd_exp, data, request);
 }
 
-static int cobd_md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
+static int cobd_md_valid_attrs(struct obd_export *exp,
+                               struct lustre_id *id)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -929,7 +982,7 @@ static int cobd_md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_valid_attrs(cobd_exp, fid);
+        return md_valid_attrs(cobd_exp, id);
 }
 
 static int cobd_md_rename(struct obd_export *exp, struct mdc_op_data *data,
@@ -979,7 +1032,8 @@ static int cobd_md_setattr(struct obd_export *exp, struct mdc_op_data *data,
         return md_setattr(cobd_exp, data, iattr, ea, ealen, ea2, ea2len, request);
 }
 
-static int cobd_md_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
+static int cobd_md_readpage(struct obd_export *exp,
+                            struct lustre_id *mdc_id,
                             __u64 offset, struct page *page, 
                             struct ptlrpc_request **request)
 {
@@ -992,7 +1046,7 @@ static int cobd_md_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_readpage(cobd_exp, mdc_fid, offset, page, request);
+        return md_readpage(cobd_exp, mdc_id, offset, page, request);
 }
 
 static int cobd_md_close(struct obd_export *exp, struct obdo *obdo,
@@ -1025,7 +1079,7 @@ static int cobd_md_done_writing(struct obd_export *exp, struct obdo *obdo)
         return md_done_writing(cobd_exp, obdo);
 }
 
-static int cobd_md_sync(struct obd_export *exp, struct ll_fid *fid,
+static int cobd_md_sync(struct obd_export *exp, struct lustre_id *id,
                         struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -1038,7 +1092,7 @@ static int cobd_md_sync(struct obd_export *exp, struct ll_fid *fid,
         }
         cobd_exp = cobd_get_exp(obd);
         
-        return md_sync(cobd_exp, fid, request);
+        return md_sync(cobd_exp, id, request);
 }
 
 static int cobd_md_set_open_replay_data(struct obd_export *exp,
@@ -1127,10 +1181,9 @@ static int cobd_md_enqueue(struct obd_export *exp, int lock_type,
                           cb_data);
 }
 
-static int cobd_md_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
-                               struct ll_fid *pfid, const char *name, int len,
-                               void *lmm, int lmmsize,
-                               struct ll_fid *cfid, struct lookup_intent *it,
+static int cobd_md_intent_lock(struct obd_export *exp, struct lustre_id *pid, 
+                               const char *name, int len, void *lmm, int lmmsize,
+                               struct lustre_id *cid, struct lookup_intent *it,
                                int lookup_flags, struct ptlrpc_request **reqp,
                                ldlm_blocking_callback cb_blocking)
 {
@@ -1143,12 +1196,12 @@ static int cobd_md_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_intent_lock(cobd_exp, uctxt, pfid, name, len, lmm, lmmsize,
-                              cfid, it, lookup_flags, reqp, cb_blocking);
+        return md_intent_lock(cobd_exp, pid, name, len, lmm, lmmsize,
+                              cid, it, lookup_flags, reqp, cb_blocking);
 }
 
-static struct obd_device * cobd_md_get_real_obd(struct obd_export *exp,
-                                                char *name, int len)
+static struct obd_device *cobd_md_get_real_obd(struct obd_export *exp,
+                                               struct lustre_id *id)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -1159,12 +1212,12 @@ static struct obd_device * cobd_md_get_real_obd(struct obd_export *exp,
                 return NULL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_get_real_obd(cobd_exp, name, len);
+        return md_get_real_obd(cobd_exp, id);
 }
 
 static int cobd_md_change_cbdata_name(struct obd_export *exp,
-                                      struct ll_fid *fid, char *name,
-                                      int namelen, struct ll_fid *fid2,
+                                      struct lustre_id *id, char *name,
+                                      int namelen, struct lustre_id *id2,
                                       ldlm_iterator_t it, void *data)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -1176,8 +1229,8 @@ static int cobd_md_change_cbdata_name(struct obd_export *exp,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_change_cbdata_name(cobd_exp, fid, name, namelen, fid2, it, 
-                                     data);
+        return md_change_cbdata_name(cobd_exp, id, name, namelen,
+                                     id2, it, data);
 }
 static struct obd_ops cobd_obd_ops = {
         .o_owner                = THIS_MODULE,
@@ -1232,7 +1285,7 @@ struct md_ops cobd_md_ops = {
         .m_getattr              = cobd_md_getattr,
         .m_req2lustre_md        = cobd_md_req2lustre_md,
         .m_change_cbdata        = cobd_md_change_cbdata,
-        .m_getattr_name         = cobd_md_getattr_name,
+        .m_getattr_lock         = cobd_md_getattr_lock,
         .m_create               = cobd_md_create,
         .m_unlink               = cobd_md_unlink,
         .m_valid_attrs          = cobd_md_valid_attrs,