Whamcloud - gitweb
Branch: b_new_cmd
authorwangdi <wangdi>
Sun, 23 Jul 2006 10:45:22 +0000 (10:45 +0000)
committerwangdi <wangdi>
Sun, 23 Jul 2006 10:45:22 +0000 (10:45 +0000)
update lov and llog on mdd

14 files changed:
lustre/cmm/cmm_device.c
lustre/include/lustre_mds.h
lustre/include/md_object.h
lustre/include/obd.h
lustre/mdd/Makefile.in
lustre/mdd/mdd_handler.c
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_lov.c
lustre/mdd/mdd_obd.c [deleted file]
lustre/mds/handler.c
lustre/mds/mds_lov.c
lustre/mdt/mdt_handler.c
lustre/mgs/mgs_llog.c
lustre/obdclass/llog_lvfs.c

index 92b41c4..2cd13a4 100644 (file)
@@ -74,23 +74,9 @@ static int cmm_statfs(const struct lu_context *ctxt, struct md_device *md,
         RETURN (rc);
 }
 
-int cmm_notify(const struct lu_context *ctxt, struct md_device *md,
-               struct obd_device *watched,
-               enum obd_notify_event ev, void *data)
-{
-        struct cmm_device *cmm_dev = md2cmm_dev(md);
-        int rc;
-
-        rc = cmm_child_ops(cmm_dev)->mdo_notify(ctxt, cmm_dev->cmm_child,
-                                                watched, ev, data);
-
-        return rc;
-}
-
 static struct md_device_operations cmm_md_ops = {
         .mdo_root_get       = cmm_root_get,
         .mdo_statfs         = cmm_statfs,
-        .mdo_notify         = cmm_notify
 };
 
 extern struct lu_device_type mdc_device_type;
index b0ef627..7bfb988 100644 (file)
@@ -103,4 +103,9 @@ int md_lov_start_synchronize(struct obd_device *obd, struct md_lov_info *mli,
 #define IOC_REQUEST_MAX_NR               35
 
 #define MDS_LOV_MD_NAME "lov"
+#define MDD_OBD_NAME    "mdd_obd"
+#define MDD_OBD_UUID    "mdd_obd_uuid"
+#define MDD_OBD_TYPE    "mds"
+#define MDD_OBD_PROFILE "lustre-MDT0000"
+
 #endif
index 4a1eacc..3cd8bc3 100644 (file)
@@ -126,13 +126,6 @@ struct md_device_operations {
                             struct md_device *m, struct lu_fid *f);
         int (*mdo_statfs)(const struct lu_context *ctx,
                           struct md_device *m, struct kstatfs *sfs);
-        /*
-         * notify function for metadata stack
-         */
-        int (*mdo_notify)(const struct lu_context *ctx, 
-                          struct md_device *m, struct obd_device *watched, 
-                          enum obd_notify_event ev, void *data);
-
 };
 
 struct md_device {
index 8533e0c..c639f68 100644 (file)
@@ -410,6 +410,11 @@ struct md_lov_ops {
                               const void *ctxt);
         int (*ml_write_objids)(struct obd_device *obd, struct md_lov_info *mli,
                                const void *ctxt);
+        int (*ml_read_catlist)(struct obd_device *obd, void *idarray, int size,
+                               const void *ctxt);
+        int (*ml_write_catlist)(struct obd_device *obd, void *idarray, int size,
+                               const void *ctxt);
+
 };
 struct md_lov_info {
         struct obd_device               *md_lov_obd; /* XXX lov_obd */
index 308761f..a2a7249 100644 (file)
@@ -1,4 +1,4 @@
 MODULES := mdd
-mdd-objs := mdd_handler.o mdd_lov.o mdd_obd.o
+mdd-objs := mdd_handler.o mdd_lov.o
 
 @INCLUDE_RULES@
index 3573444..4d8dca8 100644 (file)
@@ -302,7 +302,7 @@ static int mdd_process_config(const struct lu_context *ctxt,
                 rc = mdd_mount(ctxt, m);
                 if (rc)
                         GOTO(out, rc);
-                rc = mdd_lov_init(ctxt, m, cfg);
+                rc = mdd_init_obd(ctxt, m);
                 if (rc) {
                         CERROR("lov init error %d \n", rc);
                         GOTO(out, rc);
@@ -328,7 +328,6 @@ static struct lu_object_operations mdd_lu_obj_ops = {
        .loo_object_exists  = mdd_object_exists,
 };
 
-
 static void mdd_lock(const struct lu_context *ctxt,
                      struct mdd_object *obj, enum dt_lock_mode mode)
 {
@@ -1174,7 +1173,6 @@ static int mdd_readpage(const struct lu_context *ctxt, struct md_object *obj,
 struct md_device_operations mdd_ops = {
         .mdo_root_get       = mdd_root_get,
         .mdo_statfs         = mdd_statfs,
-        .mdo_notify         = mdd_notify
 };
 
 static struct md_dir_operations mdd_dir_ops = {
index 67b29c1..96a44c5 100644 (file)
 #include <asm/semaphore.h>
 #include <md_object.h>
 
-#define MDD_OBD_NAME    "mdd_obd"
-#define MDD_OBD_UUID    "mdd_obd_uuid"
-#define MDD_OBD_TYPE    "mds"
-#define MDD_OBD_PROFILE "lustre-client"
 struct dt_device;
 
 struct mdd_device {
@@ -57,13 +53,7 @@ struct mdd_thread_info {
         struct lov_mds_md mti_lmm;
 };
 
-int mdd_lov_init(const struct lu_context *ctxt, struct mdd_device *mdd,
-                 struct lustre_cfg *cfg);
-int mdd_lov_fini(const struct lu_context *ctxt, struct mdd_device *mdd);
-int mdd_notify(const struct lu_context *ctxt, struct md_device *md,
-               struct obd_device *watched, enum obd_notify_event ev,
-               void *data);
-
+int mdd_init_obd(const struct lu_context *ctxt, struct mdd_device *mdd);
 int mdd_xattr_set(const struct lu_context *ctxt, struct md_object *obj,
                   const void *buf, int buf_len, const char *name);
 int mdd_lov_set_md(const struct lu_context *ctxt, struct md_object *pobj,
index 6d36baa..bc2c5fd 100644 (file)
@@ -54,7 +54,7 @@ static int mdd_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli,
                                const void *ctxt)
 {
         struct dt_object *obj_ids = mli->md_lov_objid_obj;
-        struct lu_attr *lu_attr = &mdd_ctx_info(ctxt)->mti_attr;
+        struct lu_attr *lu_attr = NULL;
         obd_id *ids;
         int i, rc;
         ENTRY;
@@ -66,6 +66,9 @@ static int mdd_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli,
            has fewer targets. Old targets not in the lov descriptor
            during mds setup may still have valid objids. */
 
+        OBD_ALLOC_PTR(lu_attr);
+        if (!lu_attr)
+                GOTO(out, rc = -ENOMEM);
         rc = obj_ids->do_ops->do_attr_get(ctxt, obj_ids, lu_attr);
         if (rc)
                 GOTO(out, rc);
@@ -95,6 +98,8 @@ static int mdd_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli,
                        mli->md_lov_objids[i], i);
         }
 out:
+        if (lu_attr)
+                OBD_FREE_PTR(lu_attr);
         RETURN(0);
 }
 
@@ -126,90 +131,112 @@ int mdd_lov_write_objids(struct obd_device *obd, struct md_lov_info *mli,
 #endif
         RETURN(rc);
 }
+static int mdd_lov_write_catlist(struct obd_device *obd, void *idarray, int size, 
+                                 const void *ctxt)
+{
+        int rc = 0;
+        RETURN(rc);
+}
+
+static int mdd_lov_read_catlist(struct obd_device *obd, void *idarray, int size,
+                                const void *ctxt)
+{
+        int rc = 0;
+        RETURN(rc);
+}
 
 struct md_lov_ops mdd_lov_ops = {
         .ml_read_objids = mdd_lov_read_objids,
         .ml_write_objids = mdd_lov_write_objids,
+        .ml_read_catlist = mdd_lov_read_catlist,
+        .ml_write_catlist = mdd_lov_write_catlist
 };
 
-int mdd_lov_fini(const struct lu_context *ctxt, struct mdd_device *mdd)
+/*The obd is created for handling data stack for mdd*/
+int mdd_init_obd(const struct lu_context *ctxt, struct mdd_device *mdd)
 {
-        struct md_lov_info *mli = &mdd->mdd_lov_info;
-
-        obd_register_observer(mli->md_lov_obd, NULL);
-
-        if (mli->md_lov_exp) {
-                obd_disconnect(mli->md_lov_exp);
-                mli->md_lov_exp = NULL;
-        }
-
-        dt_object_fini(mli->md_lov_objid_obj);
-        return 0;
-}
-
-int mdd_lov_init(const struct lu_context *ctxt, struct mdd_device *mdd,
-                 struct lustre_cfg *cfg)
-{
-        struct md_lov_info *lov_info = &mdd->mdd_lov_info;
+        struct lustre_cfg_bufs bufs;
+        struct lustre_cfg      *lcfg;
+        struct obd_device      *obd;
         struct dt_object *obj_id;
-        struct obd_device *obd = NULL;
-        char *lov_name = NULL, *srv = NULL;
-        int rc = 0;
+        struct md_lov_info    *mli;
+        int rc;
         ENTRY;
-
-        if (IS_ERR(lov_info->md_lov_obd))
-                RETURN(PTR_ERR(lov_info->md_lov_obd));
-
-        lov_name = lustre_cfg_string(cfg, 3);
-        LASSERTF(lov_name != NULL, "MDD need lov \n");
-
+        
+        lustre_cfg_bufs_reset(&bufs, MDD_OBD_NAME);
+        lustre_cfg_bufs_set_string(&bufs, 1, MDD_OBD_TYPE);
+        lustre_cfg_bufs_set_string(&bufs, 2, MDD_OBD_UUID);
+        lustre_cfg_bufs_set_string(&bufs, 3, MDD_OBD_PROFILE);
+
+        lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
+        if (!lcfg)
+                RETURN(-ENOMEM);
+        
+        rc = class_attach(lcfg);
+        if (rc)
+                GOTO(lcfg_cleanup, rc);
+       
+        obd = class_name2obd(MDD_OBD_NAME);
+        if (!obd) {
+                CERROR("can not find obd %s \n", MDD_OBD_NAME);
+                LBUG();
+        }
+      
+        /*init mli, which will be used in following mds setup*/
+        mli = &obd->u.mds.mds_lov_info;
+        mli->md_lov_ops = &mdd_lov_ops;
+        
         obj_id = dt_store_open(ctxt, mdd->mdd_child, mdd_lov_objid_name,
-                               &lov_info->md_lov_objid_fid);
+                               &mli->md_lov_objid_fid);
         if (IS_ERR(obj_id)){
                 rc = PTR_ERR(obj_id);
                 RETURN(rc);
         }
+        mli->md_lov_objid_obj = obj_id;
 
-        LASSERT(obj_id != NULL);
-        lov_info->md_lov_objid_obj = obj_id;
-
-        srv = lustre_cfg_string(cfg, 0);
-        obd = class_name2obd(srv);
-        if (obd == NULL) {
-                CERROR("No such OBD %s\n", srv);
-                LBUG();
-        }
-        CDEBUG(D_INFO, "srv name %s, obd %p \n", obd->obd_name, obd);
-        rc = md_lov_connect(obd, lov_info, lov_name,
-                            &obd->obd_uuid, &mdd_lov_ops, ctxt);
-        if (rc)
-                GOTO(out, rc);
-out:
+        rc = class_setup(obd, lcfg);
         if (rc)
-                mdd_lov_fini(ctxt, mdd);
+                GOTO(class_detach, rc);
 
+        mdd->mdd_md_dev.md_lu_dev.ld_obd = obd;
+class_detach:
+        if (rc)
+                class_detach(obd, lcfg);
+lcfg_cleanup:
+        lustre_cfg_free(lcfg);
         RETURN(rc);
 }
 
-int mdd_notify(const struct lu_context *ctxt, struct md_device *md,
-               struct obd_device *watched,
-               enum obd_notify_event ev, void *data)
+int mdd_cleanup_obd(struct mdd_device *mdd)
 {
-       struct mdd_device *mdd = lu2mdd_dev(&md->md_lu_dev);
-        struct obd_device *obd = md2lu_dev(md)->ld_site->ls_top_dev->ld_obd;
-        int rc = 0;
+        struct lustre_cfg_bufs bufs;
+        struct md_lov_info     *mli;
+        struct lustre_cfg      *lcfg;
+        struct obd_device      *obd; 
+        int rc;
         ENTRY;
+        
+        obd = mdd->mdd_md_dev.md_lu_dev.ld_obd;
+        LASSERT(obd);
+        
+        mli = &obd->u.mds.mds_lov_info;
+        dt_object_fini(mli->md_lov_objid_obj);
+        
+        lustre_cfg_bufs_reset(&bufs, MDD_OBD_NAME);
+        lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
+        if (!lcfg)
+                RETURN(-ENOMEM);
 
-        rc = md_lov_notity_pre(obd, &mdd->mdd_lov_info, watched, ev, data);
-        if (rc) {
-                if (rc == -ENOENT || rc == -EBUSY)
-                        rc = 0;
-                RETURN(rc);
-        }
-
-        rc = md_lov_start_synchronize(obd, &mdd->mdd_lov_info, watched, data,
-                                      !(ev == OBD_NOTIFY_SYNC), ctxt);
-
+        rc = class_cleanup(obd, lcfg);
+        if (rc)
+                GOTO(lcfg_cleanup, rc);
+        
+        rc = class_detach(obd, lcfg);
+        if (rc)
+                GOTO(lcfg_cleanup, rc);
+        mdd->mdd_md_dev.md_lu_dev.ld_obd = NULL;
+lcfg_cleanup:
+        lustre_cfg_free(lcfg);
         RETURN(rc);
 }
 
@@ -271,7 +298,8 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                    struct mdd_object *child, struct lov_mds_md **lmm,
                    int *lmm_size)
 {
-        struct md_lov_info *mli = &mdd->mdd_lov_info;
+        struct obd_device *obd = mdd->mdd_md_dev.md_lu_dev.ld_obd;
+        struct obd_export *lov_exp = obd->u.mds.mds_osc_exp; 
         struct obdo *oa;
         struct lov_stripe_md *lsm = NULL;
         int rc = 0;
@@ -286,11 +314,11 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd,
                 OBD_MD_FLMODE | OBD_MD_FLUID | OBD_MD_FLGID;
         oa->o_size = 0;
 
-        rc = obd_create(mli->md_lov_exp, oa, &lsm, NULL);
+        rc = obd_create(lov_exp, oa, &lsm, NULL);
         if (rc)
                 GOTO(out_oa, rc);
 
-        rc = obd_packmd(mli->md_lov_exp, lmm, lsm);
+        rc = obd_packmd(lov_exp, lmm, lsm);
         if (rc < 0) {
                 CERROR("cannot pack lsm, err = %d\n", rc);
                 GOTO(out_oa, rc);
diff --git a/lustre/mdd/mdd_obd.c b/lustre/mdd/mdd_obd.c
deleted file mode 100644 (file)
index c56e880..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  linux/mds/mds_lov.c
- *  Lustre Metadata Server (mdd) OBD  
- *
- *  Copyright (C) 2006 Cluster File Systems, Inc.
- *   Author: wangdi <wangdi@clusterfs.com>
- *
- *   This file is part of the Lustre file system, http://www.lustre.org
- *   Lustre is a trademark of Cluster File Systems, Inc.
- *
- *   You may have signed or agreed to another license before downloading
- *   this software.  If so, you are bound by the terms and conditions
- *   of that agreement, and the following does not apply to you.  See the
- *   LICENSE file included with this distribution for more information.
- *
- *   If you did not agree to a different license, then this copy of Lustre
- *   is open source software; you can redistribute it and/or modify it
- *   under the terms of version 2 of the GNU General Public License as
- *   published by the Free Software Foundation.
- *
- *   In either case, Lustre is distributed in the hope that it will be
- *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   license text for more details.
- */
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
-#define DEBUG_SUBSYSTEM S_MDS
-
-#include <linux/module.h>
-
-#include <obd.h>
-#include <obd_class.h>
-#include <lustre_ver.h>
-#include <obd_support.h>
-#include <obd_lov.h>
-#include <lprocfs_status.h>
-
-#include <lu_object.h>
-#include <md_object.h>
-#include <dt_object.h>
-#include <lustre_mds.h>
-#include <lustre/lustre_idl.h>
-
-#include "mdd_internal.h"
-
-/*The obd is created for using llog in mdd layer*/
-int mdd_new_obd(struct mdd_device *mdd)
-{
-        struct lustre_cfg_bufs bufs;
-        struct lustre_cfg      *lcfg;
-        struct obd_device      *obd; 
-        int rc;
-        ENTRY;
-        
-        lustre_cfg_bufs_reset(&bufs, MDD_OBD_NAME);
-        lustre_cfg_bufs_set_string(&bufs, 1, MDD_OBD_TYPE);
-        lustre_cfg_bufs_set_string(&bufs, 2, MDD_OBD_UUID);
-        lustre_cfg_bufs_set_string(&bufs, 3, MDD_OBD_UUID);
-
-        lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
-        if (!lcfg)
-                RETURN(-ENOMEM);
-        
-        rc = class_attach(lcfg);
-        if (rc)
-                GOTO(lcfg_cleanup, rc);
-       
-        obd = class_name2obd(MDD_OBD_NAME);
-        if (!obd) {
-                CERROR("can not find obd %s \n", MDD_OBD_NAME);
-                LBUG();
-        }
-        
-        rc = class_setup(obd, lcfg);
-        if (rc)
-                GOTO(class_detach, rc);
-        
-        mdd->mdd_md_dev.md_lu_dev.ld_obd = obd;
-class_detach:
-        if (rc)
-                class_detach(obd, lcfg);
-lcfg_cleanup:
-        lustre_cfg_free(lcfg);
-        RETURN(rc);
-}
-
-int mdd_cleanup_obd(struct mdd_device *mdd)
-{
-        struct lustre_cfg_bufs bufs;
-        struct lustre_cfg      *lcfg;
-        struct obd_device      *obd; 
-        int rc;
-        ENTRY;
-        
-        obd = mdd->mdd_md_dev.md_lu_dev.ld_obd;
-        LASSERT(obd);
-        lustre_cfg_bufs_reset(&bufs, MDD_OBD_NAME);
-        lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
-       
-        if (!lcfg)
-                RETURN(-ENOMEM);
-
-        rc = class_cleanup(obd, lcfg);
-        if (rc)
-                GOTO(lcfg_cleanup, rc);
-        
-        rc = class_detach(obd, lcfg);
-        if (rc)
-                GOTO(lcfg_cleanup, rc);
-        mdd->mdd_md_dev.md_lu_dev.ld_obd = NULL;
-lcfg_cleanup:
-        lustre_cfg_free(lcfg);
-        RETURN(rc);
-}
index fac5b55..1f35aac 100644 (file)
@@ -2097,9 +2097,10 @@ int mds_postrecov(struct obd_device *obd)
         }
 
         /* clean PENDING dir */
-        rc = mds_cleanup_pending(obd);
-        if (rc < 0)
-                GOTO(out, rc);
+        if (strcmp(obd->obd_name, MDD_OBD_NAME))
+                rc = mds_cleanup_pending(obd);
+                if (rc < 0)
+                        GOTO(out, rc);
 
         /* FIXME Does target_finish_recovery really need this to block? */
         /* Notify the LOV, which will in turn call mds_notify for each tgt */
@@ -2681,7 +2682,7 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         ENTRY;
 
         CDEBUG(D_INFO, "obd %s setup \n", obd->obd_name);
-        if (strcmp(obd->obd_name, "mdd_obd"))
+        if (strcmp(obd->obd_name, MDD_OBD_NAME))
                 RETURN(0);
         
         rc = mds_lov_presetup(mds, lcfg);
@@ -2693,6 +2694,10 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         rc = mds_postsetup(obd);
         obd->obd_async_recov = 0;
 
+        sema_init(&mds->mds_orphan_recovery_sem, 1);
+        mds->mds_max_mdsize = sizeof(struct lov_mds_md);
+        mds->mds_max_cookiesize = sizeof(struct llog_cookie);
+        
         RETURN(rc);
 }
 
index fb51ca7..eda390f 100644 (file)
@@ -39,6 +39,7 @@
 #include <lustre_lib.h>
 #include <lustre_fsfilt.h>
 #include <lustre_ver.h>
+#include <dt_object.h>
 
 #include "mds_internal.h"
 
@@ -315,6 +316,8 @@ static int mds_lov_update_mds(struct obd_device *obd,
                 llog_cat_initialize(obd, mli->md_lov_desc.ld_tgt_count);
                 up(&mli->md_lov_orphan_recovery_sem);
         }
+        CDEBUG(D_CONFIG, "reset llogs idx=%d\n", idx);
+        llog_cat_initialize(obd, mli->md_lov_desc.ld_tgt_count);
 #endif
         RETURN(rc);
 }
@@ -340,8 +343,6 @@ int md_lov_connect(struct obd_device *obd, struct md_lov_info *mli,
                 RETURN(-ENOTCONN);
         }
 
-        mli->md_lov_ops = mlo;
-
         OBD_ALLOC(data, sizeof(*data));
         if (data == NULL)
                 RETURN(-ENOMEM);
@@ -707,8 +708,8 @@ static int __mds_lov_synchronize(void *data)
                                 KEY_MDS_CONN, 0, uuid, NULL);
         if (rc != 0)
                 GOTO(out, rc);
+
 #if 0
-        /*disable for not support llog in mdd*/
         rc = llog_connect(llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT),
                           mds->mds_lov_desc.ld_tgt_count,
                           NULL, NULL, uuid);
index bb8e289..d83e9c6 100644 (file)
@@ -2621,35 +2621,12 @@ static int mdt_destroy_export(struct obd_export *export)
         RETURN(rc);
 }
 
-static int mdt_notify(struct obd_device *obd, struct obd_device *watched,
-                      enum obd_notify_event ev, void *data)
-{
-        struct mdt_device *mdt;
-        struct md_device *next;
-        struct lu_context ctxt;
-        int rc;
-        ENTRY;
-
-        lu_context_init(&ctxt, LCT_MD_THREAD);
-
-        mdt = mdt_dev(obd->obd_lu_dev);
-        next = mdt->mdt_child;
-
-        lu_context_enter(&ctxt);
-        rc = next->md_ops->mdo_notify(&ctxt, next, watched, ev, data);
-        lu_context_exit(&ctxt);
-
-        lu_context_fini(&ctxt);
-        RETURN(rc);
-}
-
 static struct obd_ops mdt_obd_device_ops = {
         .o_owner          = THIS_MODULE,
         .o_connect        = mdt_obd_connect,
         .o_disconnect     = mdt_obd_disconnect,
         .o_init_export    = mdt_init_export,    /* By Huang Hua*/
         .o_destroy_export = mdt_destroy_export, /* By Huang Hua*/
-        .o_notify         = mdt_notify,
 };
 
 static void mdt_device_free(const struct lu_context *ctx, struct lu_device *d)
index f0d4c91..bf04996 100644 (file)
@@ -1210,7 +1210,7 @@ static int mgs_write_log_mdt0(struct obd_device *obd, struct fs_db *fsdb,
 {
         char *log = mti->mti_svname;
         struct llog_handle *llh = NULL;
-        char *uuid, *lovname;
+        char *uuid, *lovname, *lmvname;
         char mdt_index[5];
         int rc = 0;
         ENTRY;
@@ -1222,6 +1222,7 @@ static int mgs_write_log_mdt0(struct obd_device *obd, struct fs_db *fsdb,
                 RETURN(-ENOMEM);
 
         name_create(log, "-mdtlov", &lovname);
+        name_create(log, "-mdtlmv", &lmvname);
         if (mgs_log_is_empty(obd, log)) {
                 rc = mgs_write_log_lov(obd, fsdb, mti, log, lovname);
         } 
@@ -1232,6 +1233,8 @@ static int mgs_write_log_mdt0(struct obd_device *obd, struct fs_db *fsdb,
         rc = record_start_log(obd, &llh, log);
         rc = record_marker(obd, llh, fsdb, CM_START, log, "add mdt");
         rc = record_attach(obd, llh, log, LUSTRE_MDT0_NAME, uuid);
+        /*FIXME: lmvname maybe not right now*/
+        rc = record_mount_opt(obd, llh, log, lovname, lmvname);
         rc = record_setup(obd, llh, log, uuid, mdt_index, lovname, 0);
         rc = record_marker(obd, llh, fsdb, CM_END, log, "add mdt");
         rc = record_end_log(obd, &llh);
index 2eedc32..ec9e739 100644 (file)
@@ -43,6 +43,7 @@
 #include <obd_class.h>
 #include <lustre_log.h>
 #include <obd_ost.h>
+#include <lustre_mds.h>
 #include <libcfs/list.h>
 #include <lvfs.h>
 #include <lustre_fsfilt.h>
@@ -712,6 +713,12 @@ int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
         if (!count) 
                 return (0);
 
+        if (!strcmp(disk_obd->obd_name, MDD_OBD_NAME)) {
+                struct md_lov_info *mli = &disk_obd->u.mds.mds_lov_info;
+                rc = mli->md_lov_ops->ml_read_catlist(disk_obd, idarray,
+                                                       size, NULL);
+                return (0);
+        }
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700);
         if (!file || IS_ERR(file)) {
@@ -757,6 +764,12 @@ int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
         if (!count) 
                 return (0);
 
+        if (!strcmp(disk_obd->obd_name, MDD_OBD_NAME)) {
+                struct md_lov_info *mli = &disk_obd->u.mds.mds_lov_info;
+                rc = mli->md_lov_ops->ml_write_catlist(disk_obd, idarray,
+                                                        size, NULL);
+                return (0);
+        }
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700);
         if (!file || IS_ERR(file)) {