Whamcloud - gitweb
add cmm_mdc.c to handle set of mdc on mds
authortappro <tappro>
Tue, 18 Apr 2006 20:53:31 +0000 (20:53 +0000)
committertappro <tappro>
Tue, 18 Apr 2006 20:53:31 +0000 (20:53 +0000)
changes in cmm for support device configuring

lustre/cmm/Makefile.in
lustre/cmm/cmm_device.c
lustre/cmm/cmm_internal.h
lustre/cmm/cmm_mdc.c [new file with mode: 0644]

index c7f4042..c06a9e2 100644 (file)
@@ -1,4 +1,4 @@
 MODULES := cmm
-cmm-objs := cmm_device.o cmm_object.o
+cmm-objs := cmm_device.o cmm_object.o cmm_mdc.o
 
 @INCLUDE_RULES@
index d4f72df..982a057 100644 (file)
@@ -83,6 +83,23 @@ static struct lu_device *cmm_device_fini(struct lu_device *d)
         return next;
 }
 
+static int cmm_device_config(struct lu_device *d, struct lustre_cfg *cfg) 
+{
+        struct cmm_device *m = lu2cmm_dev(d);
+        int err;
+
+        switch(cfg->lcfg_command) {
+        case LCFG_CMM_ADD_MDC:
+                err = cmm_add_mdc(m, cfg);
+                break;
+        default:
+                err = -EOPNOTSUPP;
+        }
+out:
+        RETURN(err);
+}
+
+
 static struct lu_device_operations cmm_lu_ops = {
        .ldo_object_alloc   = cmm_object_alloc,
        .ldo_object_init    = cmm_object_init,
@@ -140,7 +157,8 @@ static struct lu_device_type_operations cmm_device_type_ops = {
         .ldto_device_free  = cmm_device_free,
 
         .ldto_device_init = cmm_device_init,
-        .ldto_device_fini = cmm_device_fini
+        .ldto_device_fini = cmm_device_fini,
+        .ldto_device_config = cmm_device_config
 };
 
 static struct lu_device_type cmm_device_type = {
index 2536f3a..1408cec 100644 (file)
@@ -84,6 +84,9 @@ static inline struct md_object *cmm2child_obj(struct cmm_object *o)
         return lu2md(lu_object_next(&o->cmo_obj.mo_lu));
 }
 
+/* cmm device */
+int cmm_add_mdc(struct cmm_device *, struct lustre_cfg *);
+
 /* cmm_object.c */
 int cmm_object_init(struct lu_context *ctxt, struct lu_object*);
 struct lu_object *cmm_object_alloc(struct lu_context *ctx, struct lu_device *);
diff --git a/lustre/cmm/cmm_mdc.c b/lustre/cmm/cmm_mdc.c
new file mode 100644 (file)
index 0000000..f8ec2ab
--- /dev/null
@@ -0,0 +1,52 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  lustre/cmm/cmm_device.c
+ *  Lustre Cluster Metadata Manager (cmm)
+ *
+ *  Copyright (c) 2006 Cluster File Systems, Inc.
+ *   Author: Mike Pershin <tappro@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 <linux/obd.h>
+#include <linux/obd_class.h>
+
+#include "cmm_internal.h"
+
+#include <linux/lprocfs_status.h>
+#include <linux/lustre_ver.h>
+
+int cmm_add_mdc(struct cmm_device * cm, struct lustre_cfg *cfg)
+{
+        const char *mdc = lustre_cfg_string(cfg, 1);
+        const char *index = lustre_cfg_string(cfg, 2);
+        ENTRY;
+
+        CDEBUG(D_INFO, "Add new MDC %s index %s\n", mdc, index);
+        RETURN(0);
+}