Whamcloud - gitweb
LU-1302 llog: llog test update and fixes
[fs/lustre-release.git] / lustre / mdd / mdd_lproc.c
index 769548b..44e3b8f 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
  * Author: Wang Di <wangdi@clusterfs.com>
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_MDS
 
-#include <linux/module.h>
-#include <linux/poll.h>
 #include <obd.h>
 #include <obd_class.h>
-#include <lustre_ver.h>
 #include <obd_support.h>
 #include <lprocfs_status.h>
 #include <lu_time.h>
-#include <lustre_log.h>
-#include <lustre/lustre_idl.h>
 #include <libcfs/libcfs_string.h>
 
 #include "mdd_internal.h"
@@ -188,8 +178,8 @@ static int lprocfs_wr_changelog_mask(struct file *file, const char *buffer,
                 GOTO(out, rc = -EFAULT);
         kernbuf[count] = 0;
 
-        rc = libcfs_str2mask(kernbuf, changelog_type2str, &mdd->mdd_cl.mc_mask,
-                             CHANGELOG_MINMASK, CHANGELOG_ALLMASK);
+        rc = cfs_str2mask(kernbuf, changelog_type2str, &mdd->mdd_cl.mc_mask,
+                          CHANGELOG_MINMASK, CHANGELOG_ALLMASK);
         if (rc == 0)
                 rc = count;
 out:
@@ -203,8 +193,9 @@ struct cucb_data {
         int idx;
 };
 
-static int lprocfs_changelog_users_cb(struct llog_handle *llh,
-                                      struct llog_rec_hdr *hdr, void *data)
+static int lprocfs_changelog_users_cb(const struct lu_env *env,
+                                     struct llog_handle *llh,
+                                     struct llog_rec_hdr *hdr, void *data)
 {
         struct llog_changelog_user_rec *rec;
         struct cucb_data *cucb = (struct cucb_data *)data;
@@ -251,8 +242,8 @@ static int lprocfs_rd_changelog_users(char *page, char **start, off_t off,
         cucb.idx += snprintf(cucb.page + cucb.idx, cucb.count - cucb.idx,
                               "%-5s %s\n", "ID", "index");
 
-        llog_cat_process(ctxt->loc_handle, lprocfs_changelog_users_cb,
-                         &cucb, 0, 0);
+       llog_cat_process(NULL, ctxt->loc_handle, lprocfs_changelog_users_cb,
+                        &cucb, 0, 0);
 
         llog_ctxt_put(ctxt);
         return cucb.idx;
@@ -299,6 +290,35 @@ static int lprocfs_wr_sync_perm(struct file *file, const char *buffer,
         return count;
 }
 
+static int lprocfs_rd_lfsck_speed_limit(char *page, char **start, off_t off,
+                                       int count, int *eof, void *data)
+{
+       struct mdd_device *mdd = data;
+
+       LASSERT(mdd != NULL);
+       *eof = 1;
+       return snprintf(page, count, "%u\n", mdd->mdd_lfsck.ml_speed_limit);
+}
+
+static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
+                                       unsigned long count, void *data)
+{
+       struct mdd_device *mdd = data;
+       struct md_lfsck *lfsck;
+       __u32 val;
+       int rc;
+
+       LASSERT(mdd != NULL);
+       rc = lprocfs_write_helper(buffer, count, &val);
+       if (rc)
+               return rc;
+
+       lfsck = &mdd->mdd_lfsck;
+       if (val != lfsck->ml_speed_limit)
+               mdd_lfsck_set_speed(lfsck, val);
+       return count;
+}
+
 static struct lprocfs_vars lprocfs_mdd_obd_vars[] = {
         { "atime_diff",      lprocfs_rd_atime_diff, lprocfs_wr_atime_diff, 0 },
         { "changelog_mask",  lprocfs_rd_changelog_mask,
@@ -309,7 +329,9 @@ static struct lprocfs_vars lprocfs_mdd_obd_vars[] = {
                              mdd_lprocfs_quota_wr_type, 0 },
 #endif
         { "sync_permission", lprocfs_rd_sync_perm, lprocfs_wr_sync_perm, 0 },
-        { 0 }
+       { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit,
+                              lprocfs_wr_lfsck_speed_limit, 0 },
+       { 0 }
 };
 
 static struct lprocfs_vars lprocfs_mdd_module_vars[] = {