Whamcloud - gitweb
LU-1187 lmv: Locate right MDT in lmv.
[fs/lustre-release.git] / lustre / lod / lod_dev.c
index e0bf92b..03ae13e 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright  2009 Sun Microsystems, Inc. All rights reserved
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel, Inc.
+ * Copyright (c) 2012, Intel Corporation.
  *
  */
 /*
@@ -406,7 +406,6 @@ static int lod_init0(const struct lu_env *env, struct lod_device *lod,
                     struct lu_device_type *ldt, struct lustre_cfg *cfg)
 {
        struct dt_device_param ddp;
-       struct proc_dir_entry *lov_proc_dir;
        struct obd_device     *obd;
        int                    rc;
        ENTRY;
@@ -435,30 +434,18 @@ static int lod_init0(const struct lu_env *env, struct lod_device *lod,
        if (rc)
                GOTO(out_disconnect, rc);
 
-       /* for compatibility we link old procfs's OSC entries to osp ones */
-       lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov");
-       if (lov_proc_dir) {
-               cfs_proc_dir_entry_t *symlink = NULL;
-               char *name;
-               OBD_ALLOC(name, strlen(obd->obd_name) + 1);
-               if (name) {
-                       strcpy(name, obd->obd_name);
-                       if (strstr(name, "lov"))
-                               symlink = lprocfs_add_symlink(name,
-                                               lov_proc_dir,
-                                               "../lod/%s",
-                                               obd->obd_name);
-                       OBD_FREE(name, strlen(obd->obd_name) + 1);
-                       lod->lod_symlink = symlink;
-               }
-       }
+       rc = lod_procfs_init(lod);
+       if (rc)
+               GOTO(out_pools, rc);
 
-       cfs_mutex_init(&lod->lod_mutex);
-       cfs_init_rwsem(&lod->lod_rw_sem);
-       cfs_spin_lock_init(&lod->lod_desc_lock);
+       mutex_init(&lod->lod_mutex);
+       init_rwsem(&lod->lod_rw_sem);
+       spin_lock_init(&lod->lod_desc_lock);
 
        RETURN(0);
 
+out_pools:
+       lod_pools_fini(lod);
 out_disconnect:
        obd_disconnect(lod->lod_child_exp);
        RETURN(rc);
@@ -508,11 +495,10 @@ static struct lu_device *lod_device_fini(const struct lu_env *env,
        struct lod_device *lod = lu2lod_dev(d);
        ENTRY;
 
-       if (lod->lod_symlink)
-               lprocfs_remove(&lod->lod_symlink);
-
        lod_pools_fini(lod);
 
+       lod_procfs_fini(lod);
+
        RETURN(NULL);
 }
 
@@ -536,11 +522,11 @@ static int lod_obd_connect(const struct lu_env *env, struct obd_export **exp,
 
        *exp = class_conn2export(&conn);
 
-       cfs_mutex_lock(&lod->lod_mutex);
+       mutex_lock(&lod->lod_mutex);
        lod->lod_connects++;
        /* at the moment we expect the only user */
        LASSERT(lod->lod_connects == 1);
-       cfs_mutex_unlock(&lod->lod_mutex);
+       mutex_unlock(&lod->lod_mutex);
 
        RETURN(0);
 }
@@ -557,16 +543,16 @@ static int lod_obd_disconnect(struct obd_export *exp)
        ENTRY;
 
        /* Only disconnect the underlying layers on the final disconnect. */
-       cfs_mutex_lock(&lod->lod_mutex);
+       mutex_lock(&lod->lod_mutex);
        lod->lod_connects--;
        if (lod->lod_connects != 0) {
                /* why should there be more than 1 connect? */
-               cfs_mutex_unlock(&lod->lod_mutex);
+               mutex_unlock(&lod->lod_mutex);
                CERROR("%s: disconnect #%d\n", exp->exp_obd->obd_name,
                       lod->lod_connects);
                goto out;
        }
-       cfs_mutex_unlock(&lod->lod_mutex);
+       mutex_unlock(&lod->lod_mutex);
 
        /* the last user of lod has gone, let's release the device */
        release = 1;