Whamcloud - gitweb
b=15266
[fs/lustre-release.git] / lustre / cmm / mdc_device.c
index 6142f36..d5518f6 100644 (file)
@@ -1,29 +1,43 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  lustre/cmm/cmm_mdc.c
- *  Lustre Metadata Client (mdc)
+ * GPL HEADER START
  *
- *  Copyright (c) 2006 Cluster File Systems, Inc.
- *   Author: Mike Pershin <tappro@clusterfs.com>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *   This file is part of the Lustre file system, http://www.lustre.org
- *   Lustre is a trademark of Cluster File Systems, Inc.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- *   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.
+ * This program 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 GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
- *   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.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
- *   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.
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/cmm/mdc_device.c
+ *
+ * Lustre Metadata Client (mdc)
+ *
+ * Author: Mike Pershin <tappro@clusterfs.com>
  */
 
 #ifndef EXPORT_SYMTAB
@@ -136,8 +150,10 @@ static int mdc_obd_add(const struct lu_env *env,
                                          OBD_CONNECT_MDS_CAPA |
                                          OBD_CONNECT_OSS_CAPA | 
                                          OBD_CONNECT_IBITS |
-                                         OBD_CONNECT_MDS_MDS;
-                rc = obd_connect(env, conn, mdc, &mdc->obd_uuid, ocd);
+                                         OBD_CONNECT_MDS_MDS |
+                                         OBD_CONNECT_FID |
+                                         OBD_CONNECT_AT;
+                rc = obd_connect(env, conn, mdc, &mdc->obd_uuid, ocd, NULL);
                 OBD_FREE_PTR(ocd);
                 if (rc) {
                         CERROR("target %s connect error %d\n",
@@ -234,7 +250,7 @@ static struct lu_device_operations mdc_lu_ops = {
         .ldo_process_config = mdc_process_config
 };
 
-void mdc_init_ea_size(const struct lu_env *env, struct mdc_device *mc, 
+void cmm_mdc_init_ea_size(const struct lu_env *env, struct mdc_device *mc,
                       int max_mdsize, int max_cookiesize)
 {
         struct obd_device *obd = class_exp2obd(mc->mc_desc.cl_exp);
@@ -256,9 +272,9 @@ static struct lu_device *mdc_device_fini(const struct lu_env *env,
         RETURN (NULL);
 }
 
-struct lu_device *mdc_device_alloc(const struct lu_env *env,
-                                   struct lu_device_type *ldt,
-                                   struct lustre_cfg *cfg)
+static struct lu_device *mdc_device_alloc(const struct lu_env *env,
+                                          struct lu_device_type *ldt,
+                                          struct lustre_cfg *cfg)
 {
         struct lu_device  *ld;
         struct mdc_device *mc;
@@ -278,22 +294,27 @@ struct lu_device *mdc_device_alloc(const struct lu_env *env,
 
         RETURN (ld);
 }
-void mdc_device_free(const struct lu_env *env, struct lu_device *ld)
+
+static struct lu_device *mdc_device_free(const struct lu_env *env,
+                                         struct lu_device *ld)
 {
         struct mdc_device *mc = lu2mdc_dev(ld);
 
        LASSERTF(atomic_read(&ld->ld_ref) == 0,
                  "Refcount = %i\n", atomic_read(&ld->ld_ref));
         LASSERT(list_empty(&mc->mc_linkage));
-       md_device_fini(&mc->mc_md_dev);
+        md_device_fini(&mc->mc_md_dev);
         OBD_FREE_PTR(mc);
+        return NULL;
 }
 
-/* context key constructor/destructor */
+/* context key constructor/destructor: mdc_key_init, mdc_key_fini */
 LU_KEY_INIT_FINI(mdc, struct mdc_thread_info);
 
+/* context key: mdc_thread_key */
 LU_CONTEXT_KEY_DEFINE(mdc, LCT_MD_THREAD|LCT_CL_THREAD);
 
+/* type constructor/destructor: mdc_type_init, mdc_type_fini */
 LU_TYPE_INIT_FINI(mdc, &mdc_thread_key);
 
 static struct lu_device_type_operations mdc_device_type_ops = {
@@ -313,4 +334,3 @@ struct lu_device_type mdc_device_type = {
         .ldt_ops      = &mdc_device_type_ops,
         .ldt_ctx_tags = LCT_MD_THREAD|LCT_CL_THREAD
 };
-