Whamcloud - gitweb
LU-1337 vfs: kernel 3.3 hides vfsmount guts
[fs/lustre-release.git] / lustre / mgs / lproc_mgs.c
index b673280..fad189e 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.
  * 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.
+ *
+ * Copyright (c) 2011, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 static int lprocfs_mgs_rd_mntdev(char *page, char **start, off_t off, int count,
                                  int *eof, void *data)
 {
-        struct obd_device* obd = (struct obd_device *)data;
+       struct obd_device *obd = (struct obd_device *)data;
 
-        LASSERT(obd != NULL);
-        LASSERT(obd->u.mgs.mgs_vfsmnt->mnt_devname);
-        *eof = 1;
+       LASSERT(obd != NULL);
+       LASSERT(mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
+       *eof = 1;
 
-        return snprintf(page, count, "%s\n",obd->u.mgs.mgs_vfsmnt->mnt_devname);
+       return snprintf(page, count, "%s\n",
+                       mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
 }
 
 static int mgs_fs_seq_show(struct seq_file *seq, void *v)
 {
         struct obd_device *obd = seq->private;
         struct mgs_obd *mgs = &obd->u.mgs;
-        struct list_head dentry_list;
+        cfs_list_t dentry_list;
         struct l_linux_dirent *dirent, *n;
         int rc, len;
         ENTRY;
@@ -73,8 +74,8 @@ static int mgs_fs_seq_show(struct seq_file *seq, void *v)
                 CERROR("Can't read config dir\n");
                 RETURN(rc);
         }
-        list_for_each_entry_safe(dirent, n, &dentry_list, lld_list) {
-                list_del(&dirent->lld_list);
+        cfs_list_for_each_entry_safe(dirent, n, &dentry_list, lld_list) {
+                cfs_list_del(&dirent->lld_list);
                 len = strlen(dirent->lld_name);
                 if ((len > 7) && (strncmp(dirent->lld_name + len - 7, "-client",
                                           len) == 0)) {
@@ -128,9 +129,9 @@ static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
         if (rc)
                 return rc;
 
-        down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
-        up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         return 0;
 }
 
@@ -182,6 +183,7 @@ int lproc_mgs_cleanup(struct obd_device *obd)
         }
         lprocfs_free_per_client_stats(obd);
         lprocfs_free_obd_stats(obd);
+        lprocfs_free_md_stats(obd);
 
         return lprocfs_obd_cleanup(obd);
 }
@@ -192,16 +194,16 @@ static int mgs_live_seq_show(struct seq_file *seq, void *v)
         struct mgs_tgt_srpc_conf *srpc_tgt;
         int i;
 
-        down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
 
         seq_printf(seq, "fsname: %s\n", fsdb->fsdb_name);
-        seq_printf(seq, "flags: %#x     gen: %d\n",
+        seq_printf(seq, "flags: %#lx     gen: %d\n",
                    fsdb->fsdb_flags, fsdb->fsdb_gen);
         for (i = 0; i < INDEX_MAP_SIZE * 8; i++)
-                 if (test_bit(i, fsdb->fsdb_mdt_index_map))
+                 if (cfs_test_bit(i, fsdb->fsdb_mdt_index_map))
                          seq_printf(seq, "%s-MDT%04x\n", fsdb->fsdb_name, i);
         for (i = 0; i < INDEX_MAP_SIZE * 8; i++)
-                 if (test_bit(i, fsdb->fsdb_ost_index_map))
+                 if (cfs_test_bit(i, fsdb->fsdb_ost_index_map))
                          seq_printf(seq, "%s-OST%04x\n", fsdb->fsdb_name, i);
 
         seq_printf(seq, "\nSecure RPC Config Rules:\n");
@@ -216,11 +218,25 @@ static int mgs_live_seq_show(struct seq_file *seq, void *v)
         }
         seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
 
-        up(&fsdb->fsdb_sem);
+        lprocfs_rd_ir_state(seq, fsdb);
+
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         return 0;
 }
 
-LPROC_SEQ_FOPS_RO(mgs_live);
+static ssize_t mgs_live_seq_write(struct file *file, const char *buf,
+                                  size_t len, loff_t *off)
+{
+        struct seq_file *seq  = file->private_data;
+        struct fs_db    *fsdb = seq->private;
+        ssize_t rc;
+
+        rc = lprocfs_wr_ir_state(file, buf, len, fsdb);
+        if (rc >= 0)
+                rc = len;
+        return rc;
+}
+LPROC_SEQ_FOPS(mgs_live);
 
 int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb)
 {
@@ -253,6 +269,7 @@ struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
         { "num_exports",     lprocfs_rd_num_exports, 0, 0 },
         { "hash_stats",      lprocfs_obd_rd_hash,    0, 0 },
         { "evict_client",    0, lprocfs_wr_evict_client, 0 },
+        { "ir_timeout",      lprocfs_rd_ir_timeout, lprocfs_wr_ir_timeout, 0 },
         { 0 }
 };