Whamcloud - gitweb
LU-1866 lfsck: general framework for LFSCK 1.5
[fs/lustre-release.git] / lustre / mdd / mdd_lproc.c
index 8ec3ae2..4d8e42d 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #include <obd_class.h>
 #include <obd_support.h>
 #include <lprocfs_status.h>
-#include <lu_time.h>
 #include <libcfs/libcfs_string.h>
-
 #include "mdd_internal.h"
 
-static const char *mdd_counter_names[LPROC_MDD_NR] = {
-};
-
 int mdd_procfs_init(struct mdd_device *mdd, const char *name)
 {
         struct lprocfs_static_vars lvars;
@@ -78,9 +75,7 @@ int mdd_procfs_init(struct mdd_device *mdd, const char *name)
                 GOTO(out, rc);
         }
 
-        rc = lu_time_init(&mdd->mdd_stats,
-                          mdd->mdd_proc_entry,
-                          mdd_counter_names, ARRAY_SIZE(mdd_counter_names));
+       rc = 0;
 
         EXIT;
 out:
@@ -91,9 +86,6 @@ out:
 
 int mdd_procfs_fini(struct mdd_device *mdd)
 {
-        if (mdd->mdd_stats)
-                lu_time_fini(&mdd->mdd_stats);
-
         if (mdd->mdd_proc_entry) {
                  lprocfs_remove(&mdd->mdd_proc_entry);
                  mdd->mdd_proc_entry = NULL;
@@ -101,17 +93,6 @@ int mdd_procfs_fini(struct mdd_device *mdd)
         RETURN(0);
 }
 
-void mdd_lprocfs_time_start(const struct lu_env *env)
-{
-        lu_lprocfs_time_start(env);
-}
-
-void mdd_lprocfs_time_end(const struct lu_env *env, struct mdd_device *mdd,
-                          int idx)
-{
-        lu_lprocfs_time_end(env, mdd->mdd_stats, idx);
-}
-
 static int lprocfs_wr_atime_diff(struct file *file, const char *buffer,
                                  unsigned long count, void *data)
 {
@@ -238,9 +219,9 @@ static int lprocfs_rd_changelog_users(char *page, char **start, off_t off,
                return rc;
        }
 
-        cfs_spin_lock(&mdd->mdd_cl.mc_lock);
-        cur = mdd->mdd_cl.mc_index;
-        cfs_spin_unlock(&mdd->mdd_cl.mc_lock);
+       spin_lock(&mdd->mdd_cl.mc_lock);
+       cur = mdd->mdd_cl.mc_index;
+       spin_unlock(&mdd->mdd_cl.mc_lock);
 
         cucb.count = count;
         cucb.page = page;
@@ -291,7 +272,8 @@ static int lprocfs_rd_lfsck_speed_limit(char *page, char **start, off_t off,
 
        LASSERT(mdd != NULL);
        *eof = 1;
-       return snprintf(page, count, "%u\n", mdd->mdd_lfsck.ml_speed_limit);
+       return snprintf(page, count, "%u\n",
+                       mdd->mdd_lfsck.ml_bookmark_ram.lb_speed_limit);
 }
 
 static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
@@ -304,13 +286,21 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
 
        LASSERT(mdd != NULL);
        rc = lprocfs_write_helper(buffer, count, &val);
-       if (rc)
+       if (rc != 0)
                return rc;
 
        lfsck = &mdd->mdd_lfsck;
-       if (val != lfsck->ml_speed_limit)
-               mdd_lfsck_set_speed(lfsck, val);
-       return count;
+       if (val != lfsck->ml_bookmark_ram.lb_speed_limit) {
+               struct lu_env env;
+
+               rc = lu_env_init(&env, LCT_MD_THREAD | LCT_DT_THREAD);
+               if (rc != 0)
+                       return rc;
+
+               rc = mdd_lfsck_set_speed(&env, lfsck, val);
+               lu_env_fini(&env);
+       }
+       return rc != 0 ? rc : count;
 }
 
 static struct lprocfs_vars lprocfs_mdd_obd_vars[] = {